Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

G2PW: A Neural Grapheme-to-Phoneme Converter for Mandarin Chinese

G2PW is a neural network model that converts Chinese (Mandarin) graphemes (characters) into phonemes.

Input

你好世界

Output

pinyin style

[ni3, hao3, shi4, jie4]

bopomofo style

[ㄋㄧ3, ㄏㄠ3, ㄕ4, ㄐㄧㄝ4]

Usage

Please ensure that the ONNX file is placed in the G2PWModel/ directory.

To run with the default text:

$ python3 g2pw.py

To specify custom text:

$ python3 g2pw.py --input '你好世界'

To specify the outout style:
[pinyin]

$ python3 g2pw.py --style pinyin

[Bopomofo]

$ python3 g2pw.py --style bopomofo

Reference

Model Format

ONNX opset=12

Netron

Python version

Python 3.6.13