semvec/pypi-packages huggingface dataset:
openccpy 0.0.4.3
Open Chinese Convert is an opensource project for conversion between Traditional Chinese and Simplified Chinese for python.
Keywords: tool,opencc,opencc-py,opencc-python,Chinese Convert,中文繁简体转换

# Openccpy

```
  ___   _____      __    ___     ___    ___   _____   __  __
 / __`\/\ '__`\  /'__`\/' _ `\  /'___\ /'___\/\ '__`\/\ \/\ \
/\ \L\ \ \ \L\ \/\  __//\ \/\ \/\ \__//\ \__/\ \ \L\ \ \ \_\ \
\ \____/\ \ ,__/\ \____\ \_\ \_\ \____\ \____\\ \ ,__/\/`____ \
 \/___/  \ \ \/  \/____/\/_/\/_/\/____/\/____/ \ \ \/  `/___/> \
          \ \_\                                 \ \_\     /\___/
           \/_/                                  \/_/     \/__/
```

[![PYPI](https://img.shields.io/pypi/v/openccpy.svg)](https://pypi.org/project/openccpy/)
[![Build Status](https://www.travis-ci.org/houbb/openccpy.svg?branch=master)](https://www.travis-ci.org/houbb/openccpy)
[![Coverage Status](https://coveralls.io/repos/github/houbb/openccpy/badge.svg?branch=master)](https://coveralls.io/github/houbb/openccpy?branch=master)

Open Chinese Convert is an opensource project for conversion between Traditional Chinese and Simplified Chinese for python.

(python 中文繁简体转换工具)

# 特性

- 支持中文繁简体转换(v0.0.2)

# Quick Start

## install

```
pip install openccpy
```

## 使用案例

```py
# coding=utf-8
from openccpy.opencc import *

class TestOpencc(object):
    """
    核心转换测试类
    """

    def test_to_simple(self):
        """
        测试转换为简体
        """
        assert "丝" == Opencc.to_simple("絲")
        assert "一目了然" == Opencc.to_simple("一目瞭然")

    def test_to_traditional(self):
        """
        测试转化为繁体
        """
        assert "絲" == Opencc.to_traditional("丝")
        assert "一目瞭然" == Opencc.to_traditional("一目了然")
```

## 方法简介

### 转为简体

```py
def to_simple(traditional):
     """
     繁体转化为简体
     1. 如果字符为空，直接返回
     2. 字符长度为1，返回对应简体字符
     3. 对应长度大于1，返回对应简体词组
     :param traditional: 繁体单词/单个词组
     :return: 对应的简体信息
     """
```

### 转为繁体

```py
def to_traditional(simple):

    """
    简体转化为繁体
    1. 如果字符为空，直接返回
    2. 字符长度为1，返回对应繁体字符
    3. 对应长度大于1，返回对应繁体词组
    :param simple: 简体单词/单个词组
    :return: 对应的繁体信息
    """
```

# 相关框架

[中文繁简体转换-java 版本](https://github.com/houbb/opencc4j)

# 下期计划

1. 添加分词功能