GithubHelp home page GithubHelp logo

num2chinese's Introduction

num2chinese

A nlp tool to transform numbers to Chinese

num2chinese uses regular expression to parse alphanumeric literals and transform them into readable Chinese charaters.

Why it matters

  • Chinese's pronuncication has lots of exceptions.
  • For Chinese numbers, a character is uttered dependent of context.
  • Lots of rules are required to handle messy Chinese number pronunciation. Dont' reinvent the wheel!

Examples

  • $120 : 美金一百二十
  • 200塊 : 兩百塊
  • 12121212個蘋果 : 一千兩百一十二萬一千兩百一十二個蘋果
  • 2002002支 : 兩百萬兩千零二支
  • 9487 : 九四八七
  • 080080123 : 零八零零八零一二

Usage

text = '12121212個蘋果''
normalizer = Normalizer()
text_normalized = normalizer.normalize(text)
print(text_normalized)
# result is '一千兩百萬十二萬一千兩百一十二個蘋果'

Installation

pip install num2chinese

Requirements

python>=3.6,<4.0

License

MIT license

num2chinese's People

Contributors

nicolaskodak avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.