Python Myanmar Readthedocs Io en Latest
Python Myanmar Readthedocs Io en Latest
Release 1.9.0
Thura Hlaing
1 Installation 3
1.1 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Syllabification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Encodings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Transliteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.5 Phonenumbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.6 Myanmar NRC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.7 Credits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Index 11
i
ii
Python Myanmar Documentation, Release 1.9.0
This package contains a variety of python modules for Myanmar text proccesing, such as syllabification, romanization,
encoding conversion, nrc validation etc. Only python3 is currently supported at the moment.
Contents: 1
Python Myanmar Documentation, Release 1.9.0
2 Contents:
CHAPTER 1
Installation
1.1 Installation
This is the preferred method to install Python Myanmar, as it will always install the most recent stable release.
If you don’t have pip installed, this Python installation guide can guide you through the process.
The sources for Python Myanmar can be downloaded from the Github repo.
You can either clone the public repository:
Once you have a copy of the source, you can install it with:
3
Python Myanmar Documentation, Release 1.9.0
1.2 Syllabification
Morphological and phonetic syllable break for Burmese text. Syllable break with zawgyi text will not be accurate /
reliable. You probably should convert it to unicode before processing.
myanmar.language.MorphoSyllableBreak(text, encoding)
Return an iterable of morphological / visual syllables in text.
myanmar.language.PhonemicSyllableBreak(text, encoding)
Return an iterable of phonemic syllables in text.
1.3 Encodings
Convert text in various Myanmar encodings. It currently supports wininnwa, zawgyi, unicode. Perfomance-wise, it
is not as good as other regex-based converters.
myanmar.converter.convert(text, fromenc, toenc)
Convert text in fromenc encoding to toenc encoding.
myanmar.converter.get_supported_encodings()
Get a list of encodings supported by converter module.
>>> get_supported_encodings()
['unicode', 'zawgyi', 'wininnwa']
4 Chapter 1. Installation
Python Myanmar Documentation, Release 1.9.0
1.4 Transliteration
Transliterate Burmese text with latin characters. Currently, romanization based on BGN_PCGN, MLCTS, IPA systems
are available.
myanmar.romanizer.romanize(string, system)
Transliterate Burmese text with latin letters.
>>> romanize("", IPA)
'kpjùtà'
>>> romanize("", MLC)
'padezaraja'
>>> romanize("", BGN_PCGN)
'bin-gala-aw'
1.5 Phonenumbers
Validation and normalization for Myanmar phonenumbers. Based on mm_phonenumber module from Melomap.
class myanmar.phonenumber.Operator
An enumeration.
myanmar.phonenumber.get_landline_operator(phonenumber)
Get operator type for a given landline number.
>>> get_landline_operator('+95674601234')
'MyanmarAPN'
>>> get_landline_operator('9524261234')
'MyanmarSpeedNet'
>>> get_landline_operator('14681234')
'VoIPMyanmarGroup'
myanmar.phonenumber.get_phone_operator(phonenumber)
Get operator type for a given phonenumber.
>>> get_phone_operator('+959262624625')
<Operator.Mpt: 'MPT'>
>>> get_phone_operator('09970000234')
<Operator.Ooredoo: 'Ooredoo'>
>>> get_phone_operator('123456789')
<Operator.Unknown: 'Unknown'>
myanmar.phonenumber.is_valid_phonenumber(phonenumber)
Checks whether a given phonenumber is a valid Myanmar number or not.
>>> is_valid_phonenumber('09420028187')
True
>>> is_valid_phonenumber('+959420028187')
True
>>> is_valid_phonenumber(9420028187)
False
>>> is_valid_phonenumber(94200281870)
False
myanmar.phonenumber.normalize_phonenumber(phonenumber)
Normalize a given phonenumber into 959xxx number format.
1.4. Transliteration 5
Python Myanmar Documentation, Release 1.9.0
>>> normalize_phonenumber('09420028187')
959420028187
>>> normalize_phonenumber('+959420028187')
959420028187
>>> normalize_phonenumber('420028187')
959420028187
myanmar.nrc.normalize_nrc(nrc)
Check the given string is valid myanmar nrc or not and normalize the string to simplest form if the string is valid
>>> normalize_nrc('9/pmn(n)123456')
'9 pamana n 123456'
>>> normalize_nrc('1/bkn(n)123456')
'1 bakana n 123456'
1.7 Credits
1.7.2 Contributors
6 Chapter 1. Installation
CHAPTER 2
• genindex
• modindex
• search
7
Python Myanmar Documentation, Release 1.9.0
m
myanmar.converter, 4
myanmar.language, 4
myanmar.nrc, 6
myanmar.phonenumber, 5
myanmar.romanizer, 5
9
Python Myanmar Documentation, Release 1.9.0
C
convert() (in module myanmar.converter), 4
G
get_landline_operator() (in module myan-
mar.phonenumber), 5
get_phone_operator() (in module myan-
mar.phonenumber), 5
get_supported_encodings() (in module myan-
mar.converter), 4
I
is_valid_nrc() (in module myanmar.nrc), 6
is_valid_phonenumber() (in module myan-
mar.phonenumber), 5
M
MorphoSyllableBreak() (in module myan-
mar.language), 4
myanmar.converter (module), 4
myanmar.language (module), 4
myanmar.nrc (module), 6
myanmar.phonenumber (module), 5
myanmar.romanizer (module), 5
N
normalize_nrc() (in module myanmar.nrc), 6
normalize_phonenumber() (in module myan-
mar.phonenumber), 5
O
Operator (class in myanmar.phonenumber), 5
P
PhonemicSyllableBreak() (in module myan-
mar.language), 4
R
romanize() (in module myanmar.romanizer), 5
11