opencc-python-reimplemented


Nameopencc-python-reimplemented JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/yichen0831/opencc-python
SummaryOpenCC made with Python
upload_time2023-02-11 03:58:42
maintainer
docs_urlNone
authorYichen Huang (Eugene)
requires_python
licenseApache License
keywords chinese conversion
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 開放中文轉換(Pure Python)



Open Chinese convert (OpenCC) in pure Python.



## Introduction 簡介



[opencc-python](https://github.com/yichen0831/opencc-python) 是用純 Python 所寫,使用由 BYVoid(<byvoid.kcp@gmail.com>) 所開發的 [OpenCC](https://github.com/BYVoid/OpenCC) 中的字典檔案。

opencc-python 可以支援 Python2.7 及 Python3.x。



[opencc-python](https://github.com/yichen0831/opencc-python) is made by pure Python with the dictionary files of [OpenCC](https://github.com/BYVoid/OpenCC) which is developed by BYVoid(<byvoid.kcp@gmail.com>).



opencc-python can run with Python2.7 and Python3.x.



## Installation 安裝



將 `opencc` 這個目錄複製到你正在開發的專案中即可,或是執行(需要管理者權限):



```sh

python setup.py install

```



套件也可從 [PyPI](https://pypi.org/project/opencc-python-reimplemented/) 安裝,使用指令:



```sh

pip install opencc-python-reimplemented

```



Copy the `opencc` folder to your project, or run (admin required)



```sh

python setup.py install

```



The package can also be installed from [PyPI](https://pypi.org/project/opencc-python-reimplemented/) by issuing:



```sh

pip install opencc-python-reimplemented

```



## Usage 使用方式

### Code



``` python

from opencc import OpenCC

cc = OpenCC('s2t')  # convert from Simplified Chinese to Traditional Chinese

# can also set conversion by calling set_conversion

# cc.set_conversion('s2tw')

to_convert = '开放中文转换'

converted = cc.convert(to_convert)

```

### Command Line



```sh

usage: python -m opencc [-h] [-i <file>] [-o <file>] [-c <conversion>]

                        [--in-enc <encoding>] [--out-enc <encoding>]



optional arguments:

  -h, --help            show this help message and exit

  -i <file>, --input <file>

                        Read original text from <file>. (default: None = STDIN)

  -o <file>, --output <file>

                        Write converted text to <file>. (default: None = STDOUT)

  -c <conversion>, --config <conversion>

                        Conversion (default: None)

  --in-enc <encoding>   Encoding for input (default: UTF-8)

  --out-enc <encoding>  Encoding for output (default: UTF-8)



example with UTF-8 encoded file:



  python -m opencc -c s2t -i my_simplified_input_file.txt -o my_traditional_output_file.txt



See https://docs.python.org/3/library/codecs.html#standard-encodings for list of encodings.

```



### Conversions 轉換



* `hk2s`: Traditional Chinese (Hong Kong standard) to Simplified Chinese



* `s2hk`: Simplified Chinese to Traditional Chinese (Hong Kong standard)



* `s2t`: Simplified Chinese to Traditional Chinese



* `s2tw`: Simplified Chinese to Traditional Chinese (Taiwan standard)



* `s2twp`: Simplified Chinese to Traditional Chinese (Taiwan standard, with phrases)



* `t2hk`: Traditional Chinese to Traditional Chinese (Hong Kong standard)



* `t2s`: Traditional Chinese to Simplified Chinese



* `t2tw`: Traditional Chinese to Traditional Chinese (Taiwan standard)



* `tw2s`: Traditional Chinese (Taiwan standard) to Simplified Chinese



* `tw2sp`: Traditional Chinese (Taiwan standard) to Simplified Chinese (with phrases)



## Issues 問題



當轉換有兩個以上的字詞可能時,程式只會使用第一個。



When there is more than one conversion available, only the first one is taken.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yichen0831/opencc-python",
    "name": "opencc-python-reimplemented",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "chinese conversion",
    "author": "Yichen Huang (Eugene)",
    "author_email": "yichen0831@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/8d/6d/c6f37eed651dd6b752e50f80a93396cdaa42a6acc6ce05ad7452303ea511/opencc-python-reimplemented-0.1.7.tar.gz",
    "platform": null,
    "description": "\ufeff# \u958b\u653e\u4e2d\u6587\u8f49\u63db\uff08Pure Python\uff09\r\n\r\n\r\n\r\nOpen Chinese convert (OpenCC) in pure Python.\r\n\r\n\r\n\r\n## Introduction \u7c21\u4ecb\r\n\r\n\r\n\r\n[opencc-python](https://github.com/yichen0831/opencc-python) \u662f\u7528\u7d14 Python \u6240\u5beb\uff0c\u4f7f\u7528\u7531 BYVoid(<byvoid.kcp@gmail.com>) \u6240\u958b\u767c\u7684 [OpenCC](https://github.com/BYVoid/OpenCC) \u4e2d\u7684\u5b57\u5178\u6a94\u6848\u3002\r\n\r\nopencc-python \u53ef\u4ee5\u652f\u63f4 Python2.7 \u53ca Python3.x\u3002\r\n\r\n\r\n\r\n[opencc-python](https://github.com/yichen0831/opencc-python) is made by pure Python with the dictionary files of [OpenCC](https://github.com/BYVoid/OpenCC) which is developed by BYVoid(<byvoid.kcp@gmail.com>).\r\n\r\n\r\n\r\nopencc-python can run with Python2.7 and Python3.x.\r\n\r\n\r\n\r\n## Installation \u5b89\u88dd\r\n\r\n\r\n\r\n\u5c07 `opencc` \u9019\u500b\u76ee\u9304\u8907\u88fd\u5230\u4f60\u6b63\u5728\u958b\u767c\u7684\u5c08\u6848\u4e2d\u5373\u53ef\uff0c\u6216\u662f\u57f7\u884c\uff08\u9700\u8981\u7ba1\u7406\u8005\u6b0a\u9650\uff09\uff1a\r\n\r\n\r\n\r\n```sh\r\n\r\npython setup.py install\r\n\r\n```\r\n\r\n\r\n\r\n\u5957\u4ef6\u4e5f\u53ef\u5f9e [PyPI](https://pypi.org/project/opencc-python-reimplemented/) \u5b89\u88dd\uff0c\u4f7f\u7528\u6307\u4ee4\uff1a\r\n\r\n\r\n\r\n```sh\r\n\r\npip install opencc-python-reimplemented\r\n\r\n```\r\n\r\n\r\n\r\nCopy the `opencc` folder to your project, or run (admin required)\r\n\r\n\r\n\r\n```sh\r\n\r\npython setup.py install\r\n\r\n```\r\n\r\n\r\n\r\nThe package can also be installed from [PyPI](https://pypi.org/project/opencc-python-reimplemented/) by issuing:\r\n\r\n\r\n\r\n```sh\r\n\r\npip install opencc-python-reimplemented\r\n\r\n```\r\n\r\n\r\n\r\n## Usage \u4f7f\u7528\u65b9\u5f0f\r\n\r\n### Code\r\n\r\n\r\n\r\n``` python\r\n\r\nfrom opencc import OpenCC\r\n\r\ncc = OpenCC('s2t')  # convert from Simplified Chinese to Traditional Chinese\r\n\r\n# can also set conversion by calling set_conversion\r\n\r\n# cc.set_conversion('s2tw')\r\n\r\nto_convert = '\u5f00\u653e\u4e2d\u6587\u8f6c\u6362'\r\n\r\nconverted = cc.convert(to_convert)\r\n\r\n```\r\n\r\n### Command Line\r\n\r\n\r\n\r\n```sh\r\n\r\nusage: python -m opencc [-h] [-i <file>] [-o <file>] [-c <conversion>]\r\n\r\n                        [--in-enc <encoding>] [--out-enc <encoding>]\r\n\r\n\r\n\r\noptional arguments:\r\n\r\n  -h, --help            show this help message and exit\r\n\r\n  -i <file>, --input <file>\r\n\r\n                        Read original text from <file>. (default: None = STDIN)\r\n\r\n  -o <file>, --output <file>\r\n\r\n                        Write converted text to <file>. (default: None = STDOUT)\r\n\r\n  -c <conversion>, --config <conversion>\r\n\r\n                        Conversion (default: None)\r\n\r\n  --in-enc <encoding>   Encoding for input (default: UTF-8)\r\n\r\n  --out-enc <encoding>  Encoding for output (default: UTF-8)\r\n\r\n\r\n\r\nexample with UTF-8 encoded file:\r\n\r\n\r\n\r\n  python -m opencc -c s2t -i my_simplified_input_file.txt -o my_traditional_output_file.txt\r\n\r\n\r\n\r\nSee https://docs.python.org/3/library/codecs.html#standard-encodings for list of encodings.\r\n\r\n```\r\n\r\n\r\n\r\n### Conversions \u8f49\u63db\r\n\r\n\r\n\r\n* `hk2s`: Traditional Chinese (Hong Kong standard) to Simplified Chinese\r\n\r\n\r\n\r\n* `s2hk`: Simplified Chinese to Traditional Chinese (Hong Kong standard)\r\n\r\n\r\n\r\n* `s2t`: Simplified Chinese to Traditional Chinese\r\n\r\n\r\n\r\n* `s2tw`: Simplified Chinese to Traditional Chinese (Taiwan standard)\r\n\r\n\r\n\r\n* `s2twp`: Simplified Chinese to Traditional Chinese (Taiwan standard, with phrases)\r\n\r\n\r\n\r\n* `t2hk`: Traditional Chinese to Traditional Chinese (Hong Kong standard)\r\n\r\n\r\n\r\n* `t2s`: Traditional Chinese to Simplified Chinese\r\n\r\n\r\n\r\n* `t2tw`: Traditional Chinese to Traditional Chinese (Taiwan standard)\r\n\r\n\r\n\r\n* `tw2s`: Traditional Chinese (Taiwan standard) to Simplified Chinese\r\n\r\n\r\n\r\n* `tw2sp`: Traditional Chinese (Taiwan standard) to Simplified Chinese (with phrases)\r\n\r\n\r\n\r\n## Issues \u554f\u984c\r\n\r\n\r\n\r\n\u7576\u8f49\u63db\u6709\u5169\u500b\u4ee5\u4e0a\u7684\u5b57\u8a5e\u53ef\u80fd\u6642\uff0c\u7a0b\u5f0f\u53ea\u6703\u4f7f\u7528\u7b2c\u4e00\u500b\u3002\r\n\r\n\r\n\r\nWhen there is more than one conversion available, only the first one is taken.\r\n\r\n",
    "bugtrack_url": null,
    "license": "Apache License",
    "summary": "OpenCC made with Python",
    "version": "0.1.7",
    "split_keywords": [
        "chinese",
        "conversion"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "306b055b7806f320cc8f2cdf23c5f70221c0dc1683fca9ffaf76dfc2ad4b91b6",
                "md5": "0d0e431912b7ab9805505b76bbe1e1a5",
                "sha256": "41b3b92943c7bed291f448e9c7fad4b577c8c2eae30fcfe5a74edf8818493aa6"
            },
            "downloads": -1,
            "filename": "opencc_python_reimplemented-0.1.7-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0d0e431912b7ab9805505b76bbe1e1a5",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 481813,
            "upload_time": "2023-02-11T03:58:39",
            "upload_time_iso_8601": "2023-02-11T03:58:39.660268Z",
            "url": "https://files.pythonhosted.org/packages/30/6b/055b7806f320cc8f2cdf23c5f70221c0dc1683fca9ffaf76dfc2ad4b91b6/opencc_python_reimplemented-0.1.7-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8d6dc6f37eed651dd6b752e50f80a93396cdaa42a6acc6ce05ad7452303ea511",
                "md5": "81be109d33658ab2455e5a55310877e3",
                "sha256": "4f777ea3461a25257a7b876112cfa90bb6acabc6dfb843bf4d11266e43579dee"
            },
            "downloads": -1,
            "filename": "opencc-python-reimplemented-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "81be109d33658ab2455e5a55310877e3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 482566,
            "upload_time": "2023-02-11T03:58:42",
            "upload_time_iso_8601": "2023-02-11T03:58:42.250281Z",
            "url": "https://files.pythonhosted.org/packages/8d/6d/c6f37eed651dd6b752e50f80a93396cdaa42a6acc6ce05ad7452303ea511/opencc-python-reimplemented-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-11 03:58:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "yichen0831",
    "github_project": "opencc-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "opencc-python-reimplemented"
}
        
Elapsed time: 0.06181s