{"id":9762,"library":"g2pkk","title":"Korean Grapheme-to-Phoneme (g2pkk)","description":"g2pkk is a Grapheme-to-Phoneme (G2P) conversion module specifically designed for Korean text, aiming for cross-platform compatibility. It is currently at version 0.1.2 and appears to have an active, though not rapid, release cadence given its early development stage.","status":"active","version":"0.1.2","language":"en","source_language":"en","source_url":"https://github.com/harmlessman/g2pkk","tags":["grapheme-to-phoneme","korean","nlp","phonetics","romanization"],"install":[{"cmd":"pip install g2pkk","lang":"bash","label":"Install g2pkk"}],"dependencies":[{"reason":"Required for Korean character processing.","package":"jamotools"},{"reason":"Required for Korean character processing.","package":"jamo"},{"reason":"Required for natural language processing tasks, specifically the 'punkt' tokenizer.","package":"nltk"},{"reason":"Used for Korean spacing correction, improving G2P accuracy.","package":"pykospacing"},{"reason":"Used for romanization of Korean text.","package":"korean-romanizer"}],"imports":[{"symbol":"G2pkk","correct":"from g2pkk import G2pkk"}],"quickstart":{"code":"import nltk\nfrom g2pkk import G2pkk\n\n# Important: Download NLTK 'punkt' resource if not already done\ntry:\n    nltk.data.find('tokenizers/punkt')\nexcept nltk.downloader.DownloadError:\n    print(\"Downloading NLTK 'punkt' resource...\")\n    nltk.download('punkt')\n\n# Initialize the G2P converter\ng2p = G2pkk()\n\n# Convert Korean text to its phoneme representation\ntext = \"안녕하세요 g2p 입니다. 반갑습니다. 123.\"\nresult = g2p(text)\nprint(f\"Original: {text}\")\nprint(f\"Phonetic: {result}\")\n\n# Example with specific romanization\ntext_roman = g2p(\"한국어\")\nprint(f\"'한국어' phonetic: {text_roman}\")","lang":"python","description":"This quickstart demonstrates how to initialize the G2pkk converter and use it to transform Korean text into its romanized phonetic representation. It includes a crucial step to ensure the NLTK 'punkt' resource is downloaded, which is a common prerequisite for many NLP libraries."},"warnings":[{"fix":"Run `import nltk; nltk.download('punkt')` once before using g2pkk. It's good practice to include this check at the start of your application.","message":"The `nltk` library, a dependency of g2pkk, requires the 'punkt' tokenizer resource to be downloaded separately. Failure to do so will result in a `LookupError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Pin your `g2pkk` dependency to exact versions (e.g., `g2pkk==0.1.2`) in your `requirements.txt` to prevent unexpected breaking changes with new releases. Review release notes for any new versions carefully.","message":"g2pkk is in early development (version 0.1.x), which means its API might undergo non-backward-compatible changes in future minor or patch releases as it approaches a stable 1.0 version.","severity":"gotcha","affected_versions":"All versions prior to 1.0.0"},{"fix":"Ensure that the majority of the input text is Korean for optimal results. Mixed language input might produce less accurate or less natural-sounding romanizations for non-Korean parts.","message":"Input text must be primarily Korean. While it handles numbers and some English, its core functionality and accuracy are designed for Korean grapheme-to-phoneme conversion.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Execute `import nltk; nltk.download('punkt')` in your Python environment. This typically only needs to be done once.","cause":"The NLTK 'punkt' tokenizer data, required by g2pkk, has not been downloaded.","error":"LookupError: Resource 'punkt' not found. Please use the NLTK Downloader to obtain the resource:"},{"fix":"Install the package using pip: `pip install g2pkk`.","cause":"The `g2pkk` package is not installed in your current Python environment.","error":"ModuleNotFoundError: No module named 'g2pkk'"},{"fix":"Refer to the official g2pkk documentation or GitHub README for the correct API usage. If you've updated the library, check for breaking changes in the release notes.","cause":"Attempting to call a method that does not exist or has been removed/renamed in the `G2pkk` class.","error":"AttributeError: 'G2pkk' object has no attribute 'some_method'"}]}