{"id":3718,"library":"opencc-python-reimplemented","title":"OpenCC made with Python","description":"OpenCC-python-reimplemented is a pure Python implementation of the Open Chinese Convert (OpenCC) library. It facilitates conversions between Traditional and Simplified Chinese, supporting character-level and phrase-level conversion, as well as handling character variants and regional idioms among Mainland China, Taiwan, and Hong Kong. The current version is 0.1.7, released in February 2023, indicating an infrequent release cadence.","status":"active","version":"0.1.7","language":"en","source_language":"en","source_url":"https://github.com/yichen0831/opencc-python","tags":["chinese","conversion","simplified-chinese","traditional-chinese","nlp"],"install":[{"cmd":"pip install opencc-python-reimplemented","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"note":"While 'import opencc' might work in some contexts, directly importing 'OpenCC' from the 'opencc' package is the standard and recommended way to access the main class for conversion.","wrong":"import opencc","symbol":"OpenCC","correct":"from opencc import OpenCC"}],"quickstart":{"code":"from opencc import OpenCC\n\ncc = OpenCC('s2t') # Initialize converter: Simplified Chinese to Traditional Chinese\nto_convert = '你好，世界！开放中文转换。'\nconverted_text = cc.convert(to_convert)\nprint(f\"Original: {to_convert}\")\nprint(f\"Converted (s2t): {converted_text}\")\n\n# Example with another conversion mode (Traditional Chinese to Simplified Chinese)\ncc_t2s = OpenCC('t2s')\nto_convert_t = '你好，世界！開放中文轉換。'\nconverted_text_s = cc_t2s.convert(to_convert_t)\nprint(f\"Original: {to_convert_t}\")\nprint(f\"Converted (t2s): {converted_text_s}\")","lang":"python","description":"This quickstart demonstrates how to initialize the OpenCC converter with a specific conversion configuration (e.g., Simplified to Traditional Chinese) and perform text conversion. It also shows an example of Traditional to Simplified Chinese conversion."},"warnings":[{"fix":"Explicitly install `pip install opencc-python-reimplemented`. If issues arise with C++ bindings, consider this pure Python alternative.","message":"There are multiple Python packages related to OpenCC (e.g., `opencc`, `opencc-py`, and `opencc-python-reimplemented`). This specific package (`opencc-python-reimplemented`) is a pure Python implementation. Other packages might be C++ bindings, which can lead to `Segmentation Fault` errors if the underlying C library is not correctly installed or compatible with the Python binding. Ensure you install `opencc-python-reimplemented` if you want the pure Python version and its associated benefits.","severity":"gotcha","affected_versions":"All versions (due to confusion with other packages)"},{"fix":"Be aware of potential instability or future API changes. Review the GitHub repository for recent activity or planned updates before relying on it for critical production systems.","message":"The project's 'Development Status' classifier is '3 - Alpha'. This indicates that the library is still in an early stage of development, may not be stable, and its API could change without strict adherence to semantic versioning, although no explicit breaking changes are documented between minor versions.","severity":"deprecated","affected_versions":"All versions up to 0.1.7"},{"fix":"If you require a self-contained Python package without external binary dependencies, `opencc-python-reimplemented` is the correct choice. Do not confuse it with `opencc-python`.","message":"The package `opencc-python` (not `opencc-python-reimplemented`) requires the OpenCC command-line tool to be installed separately, acting as a wrapper. `opencc-python-reimplemented` is a pure Python implementation and does not have this external dependency, avoiding potential setup complexities related to native binaries.","severity":"gotcha","affected_versions":"N/A (applies to `opencc-python`, not this library)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}