0% found this document useful (0 votes)
468 views15 pages

Python Myanmar Documentation: Release 1.9.0

This document provides documentation for a Python package for Myanmar text processing. It describes how to install the package and covers several modules for tasks like syllabification, encoding conversion, transliteration, phone number validation, and Myanmar National Registration Card validation. The document is the release notes for version 1.9.0 of the Python Myanmar package.

Uploaded by

jame wick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
468 views15 pages

Python Myanmar Documentation: Release 1.9.0

This document provides documentation for a Python package for Myanmar text processing. It describes how to install the package and covers several modules for tasks like syllabification, encoding conversion, transliteration, phone number validation, and Myanmar National Registration Card validation. The document is the release notes for version 1.9.0 of the Python Myanmar package.

Uploaded by

jame wick
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Python Myanmar Documentation

Release 1.9.0

Thura Hlaing

May 11, 2020


Contents:

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

2 Indices and tables 7

Python Module Index 9

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

The package is distributed on PyPI and can be installed with pip:

pip install python-myanmar

For more information, please read the full documentation here.

1.1 Installation

1.1.1 Stable release

To install Python Myanmar, run this command in your terminal:

$ pip install python-myanmar

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.

1.1.2 From sources

The sources for Python Myanmar can be downloaded from the Github repo.
You can either clone the public repository:

$ git clone git://[Link]/trhura/python-myanmar

Or download the tarball:

$ curl -OL [Link]

Once you have a copy of the source, you can install it with:

3
Python Myanmar Documentation, Release 1.9.0

$ python [Link] install

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.
[Link](text, encoding)
Return an iterable of morphological / visual syllables in text.

>>> from [Link] import UnicodeEncoding


>>> slb = list(MorphoSyllableBreak("", UnicodeEncoding()))
>>> list(s['syllable'] for s in slb)
['', '', '']
>>> slb[2]
{'syllable': '', 'consonant': '', 'eVowel': '', 'visarga': ''}

[Link](text, encoding)
Return an iterable of phonemic syllables in text.

>>> from [Link] import UnicodeEncoding


>>> slb = list(PhonemicSyllableBreak("", UnicodeEncoding()))
>>> list(s['syllable'] for s in slb)
['', '', '']
>>> slb[0]
{'syllable': '', 'consonant': '', 'iVowel': '', 'visarga': ''}

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.
[Link](text, fromenc, toenc)
Convert text in fromenc encoding to toenc encoding.

>>> convert('', 'unicode', 'zawgyi')


''
>>> convert('', 'zawgyi', 'unicode')
''
>>> convert('&[ef;', 'wininnwa', 'unicode')
''

[Link].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.
[Link](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 [Link]
An enumeration.
[Link].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'

[Link].get_phone_operator(phonenumber)
Get operator type for a given phonenumber.
>>> get_phone_operator('+959262624625')
<[Link]: 'MPT'>
>>> get_phone_operator('09970000234')
<[Link]: 'Ooredoo'>
>>> get_phone_operator('123456789')
<[Link]: 'Unknown'>

[Link].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

[Link].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

1.6 Myanmar NRC

Validation and normalization for Myanmar NRC number.


[Link].is_valid_nrc(nrc)
Check whether the given string is valid Myanmar national registration ID or not

>>> is_valid_nrc('12/LMN (N) 144144')


True
>>> is_valid_nrc('5/PMN (N) 123456')
False

[Link].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.1 Development Lead

• Thura Hlaing <trhura at [Link]>

1.7.2 Contributors

• Set Kyar Wa Lar <setkyar16 at [Link]>


• Aye Chan Mon <polestar.mon20 at [Link]>
• Soe Zayar <soezayar019@[Link]>
• Kyaw Naing Win <kyawnaingwinknw@[Link]>

6 Chapter 1. Installation
CHAPTER 2

Indices and tables

• genindex
• modindex
• search

7
Python Myanmar Documentation, Release 1.9.0

8 Chapter 2. Indices and tables


Python Module Index

m
[Link], 4
[Link], 4
[Link], 6
[Link], 5
[Link], 5

9
Python Myanmar Documentation, Release 1.9.0

10 Python Module Index


Index

C
convert() (in module [Link]), 4

G
get_landline_operator() (in module myan-
[Link]), 5
get_phone_operator() (in module myan-
[Link]), 5
get_supported_encodings() (in module myan-
[Link]), 4

I
is_valid_nrc() (in module [Link]), 6
is_valid_phonenumber() (in module myan-
[Link]), 5

M
MorphoSyllableBreak() (in module myan-
[Link]), 4
[Link] (module), 4
[Link] (module), 4
[Link] (module), 6
[Link] (module), 5
[Link] (module), 5

N
normalize_nrc() (in module [Link]), 6
normalize_phonenumber() (in module myan-
[Link]), 5

O
Operator (class in [Link]), 5

P
PhonemicSyllableBreak() (in module myan-
[Link]), 4

R
romanize() (in module [Link]), 5

11

You might also like