Basically, this is a simple python script for converting Myanmar numbers into Myanmar spoken words.
It is expected to be able to detect and convert the following types:
- Dates (DD-MM-YYYY or DD/MM/YYYY)
- Time (H:mm)
- Digit Number
- Decimal Number
- Range
- Fraction
- Amount
This is an essential part in the preprocessing stage of the Myanmar Text-to-Speech Project in which the numbers in the text dataset needs to be converted into spoken words.
# Amount
แแแ => แแ
แบแแฌแท แแฏแแพแ
แบ
แแแ => แแ
แบแแฌแท แแพแ
แบแแแบ
แแแ => แแฏแถ:แแฌ แแพแ
แบแแแบแท แแ
แบ
แแแ
แแแแแแแ => แแฏแถ:แแฑแฌแแบ: แแพแ
แบแแฑแฌแแบแท แแซ:แแฌ แแญแฏ:แแแบแท แแฏแแพแ
แบแแญแแบ: แแฏแถ:แแแบ
แ
แ,แแ
แ,แแแ => แแญแแบ: แแซ:แแฌ แแซ:แแฑแฌแแบ: แแ
แบแแฑแฌแแบแท แแพแ
แบแแฌแท แแฏแถ:แแแบ
# Phone Number
แแแ
แแแแแ => แแฏแ แแ
แบ แแซ: แแพแ
แบ แแพแ
แบ แแพแ
แบ แแพแ
แบ แแฏแถ:
# Date
แแ
-แแ-แแแแ => แแพแ
แบแแฑแฌแแบแท แแแบแท แแญแฏ: แแฏแแพแ
แบ แแแบแท แแพแ
แบ แแแญแฏแแบ: แแแบแท แแซ: แแแบ
# Time
แ:แแ
=> แแฏแถ: แแฌแแฎ แแพแ
แบแแแบแท แแซ: แแญแแ
แบ
แ:แแ => แแฑ: แแฌแแฎ แแฝแฒ
# Decimal
แแ.แแแ => แแฏแถ:แแแบแท แแพแ
แบ แแฟแ แแฑ: แแพแ
แบ แแพแ
แบ
Clone or download this repository
git clone https://github.com/hpbyte/Myanmar_Number_to_Words.git
You will see two files under the cloned directory
Myanmar_Number_to_Words
| mm_num2word.py
| convert.py
mm_num2word.py
contains all the logics needed (from extracting numbers from a string to detecting and converting).
convert.py
is the tool that is able to take an input file, transform the numbers from the file into words accordingly and then output the result file.
python3 convert.py --input path/to/your/input.txt --output path/for/output.txt