burmesenlp 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. burmesenlp-1.0.1/LICENSE +201 -0
  2. burmesenlp-1.0.1/PKG-INFO +148 -0
  3. burmesenlp-1.0.1/README.md +205 -0
  4. burmesenlp-1.0.1/README.pypi.md +111 -0
  5. burmesenlp-1.0.1/pyproject.toml +91 -0
  6. burmesenlp-1.0.1/setup.cfg +4 -0
  7. burmesenlp-1.0.1/src/burmesenlp/__init__.py +78 -0
  8. burmesenlp-1.0.1/src/burmesenlp/__main__.py +3 -0
  9. burmesenlp-1.0.1/src/burmesenlp/chunking/__init__.py +56 -0
  10. burmesenlp-1.0.1/src/burmesenlp/chunking/chunker.py +269 -0
  11. burmesenlp-1.0.1/src/burmesenlp/chunking/clause.py +823 -0
  12. burmesenlp-1.0.1/src/burmesenlp/chunking/matcher.py +295 -0
  13. burmesenlp-1.0.1/src/burmesenlp/chunking/models.py +445 -0
  14. burmesenlp-1.0.1/src/burmesenlp/chunking/noun.py +14 -0
  15. burmesenlp-1.0.1/src/burmesenlp/chunking/pattern_match.py +157 -0
  16. burmesenlp-1.0.1/src/burmesenlp/chunking/rules.py +576 -0
  17. burmesenlp-1.0.1/src/burmesenlp/chunking/verb.py +14 -0
  18. burmesenlp-1.0.1/src/burmesenlp/cli/__init__.py +133 -0
  19. burmesenlp-1.0.1/src/burmesenlp/corpus/__init__.py +27 -0
  20. burmesenlp-1.0.1/src/burmesenlp/corpus/cache.py +26 -0
  21. burmesenlp-1.0.1/src/burmesenlp/corpus/dictionaries/abbreviations.txt +2 -0
  22. burmesenlp-1.0.1/src/burmesenlp/corpus/dictionaries/emoji.txt +2 -0
  23. burmesenlp-1.0.1/src/burmesenlp/corpus/dictionaries/foreign_words.txt +2 -0
  24. burmesenlp-1.0.1/src/burmesenlp/corpus/dictionaries/slang.txt +1 -0
  25. burmesenlp-1.0.1/src/burmesenlp/corpus/dictionaries/stopwords.txt +99 -0
  26. burmesenlp-1.0.1/src/burmesenlp/corpus/dictionaries/words.txt +51702 -0
  27. burmesenlp-1.0.1/src/burmesenlp/corpus/downloader.py +67 -0
  28. burmesenlp-1.0.1/src/burmesenlp/corpus/embeddings/glove.txt +0 -0
  29. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/districts.json +84 -0
  30. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/ethnic_groups.json +136 -0
  31. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/female_names.json +2449 -0
  32. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/holidays.json +118 -0
  33. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/male_names.json +1887 -0
  34. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/metadata.json +6 -0
  35. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/mountains.json +277 -0
  36. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/organizations.json +51 -0
  37. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/pagodas.json +121 -0
  38. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/religions.json +16 -0
  39. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/rivers.json +58 -0
  40. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/self_administered_zones.json +8 -0
  41. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/states.json +23 -0
  42. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/towns.json +538 -0
  43. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/universities.json +246 -0
  44. burmesenlp-1.0.1/src/burmesenlp/corpus/gazetteers/villages.json +14048 -0
  45. burmesenlp-1.0.1/src/burmesenlp/corpus/grammar/clause_rules.yml +135 -0
  46. burmesenlp-1.0.1/src/burmesenlp/corpus/grammar/phrase_exceptions.yml +27 -0
  47. burmesenlp-1.0.1/src/burmesenlp/corpus/grammar/phrase_markers.yml +56 -0
  48. burmesenlp-1.0.1/src/burmesenlp/corpus/grammar/phrase_rules.yml +91 -0
  49. burmesenlp-1.0.1/src/burmesenlp/corpus/grammar/postposition_roles.yml +67 -0
  50. burmesenlp-1.0.1/src/burmesenlp/corpus/grammar/semantic_roles.yml +110 -0
  51. burmesenlp-1.0.1/src/burmesenlp/corpus/idioms/idioms.cache.json +26355 -0
  52. burmesenlp-1.0.1/src/burmesenlp/corpus/idioms/idioms.json +1879 -0
  53. burmesenlp-1.0.1/src/burmesenlp/corpus/loader.py +59 -0
  54. burmesenlp-1.0.1/src/burmesenlp/corpus/metadata/corpus.json +73 -0
  55. burmesenlp-1.0.1/src/burmesenlp/corpus/names/honorifics.txt +2 -0
  56. burmesenlp-1.0.1/src/burmesenlp/corpus/names/locations.txt +2 -0
  57. burmesenlp-1.0.1/src/burmesenlp/corpus/names/organizations.txt +2 -0
  58. burmesenlp-1.0.1/src/burmesenlp/corpus/names/person.txt +2 -0
  59. burmesenlp-1.0.1/src/burmesenlp/corpus/ner/gazetteer_location.txt +2 -0
  60. burmesenlp-1.0.1/src/burmesenlp/corpus/ner/gazetteer_org.txt +2 -0
  61. burmesenlp-1.0.1/src/burmesenlp/corpus/ner/gazetteer_person.txt +2 -0
  62. burmesenlp-1.0.1/src/burmesenlp/corpus/ner/labels.json +1 -0
  63. burmesenlp-1.0.1/src/burmesenlp/corpus/normalization/punctuation.json +1 -0
  64. burmesenlp-1.0.1/src/burmesenlp/corpus/normalization/unicode_rules.json +1 -0
  65. burmesenlp-1.0.1/src/burmesenlp/corpus/normalization/zawgyi_mapping.json +1 -0
  66. burmesenlp-1.0.1/src/burmesenlp/corpus/pos/lexicon.json +1 -0
  67. burmesenlp-1.0.1/src/burmesenlp/corpus/pos/tagset.json +1 -0
  68. burmesenlp-1.0.1/src/burmesenlp/corpus/registry.py +207 -0
  69. burmesenlp-1.0.1/src/burmesenlp/corpus/sentiment/emotion.json +1 -0
  70. burmesenlp-1.0.1/src/burmesenlp/corpus/sentiment/negative.txt +2 -0
  71. burmesenlp-1.0.1/src/burmesenlp/corpus/sentiment/positive.txt +2 -0
  72. burmesenlp-1.0.1/src/burmesenlp/corpus/spell/confusion.json +1 -0
  73. burmesenlp-1.0.1/src/burmesenlp/corpus/spell/corrections.json +1 -0
  74. burmesenlp-1.0.1/src/burmesenlp/corpus/spell/frequency.json +1 -0
  75. burmesenlp-1.0.1/src/burmesenlp/corpus/syllables/patterns.json +1 -0
  76. burmesenlp-1.0.1/src/burmesenlp/corpus/syllables/syllables.txt +2 -0
  77. burmesenlp-1.0.1/src/burmesenlp/corpus/tokenizer/bpe_vocab.json +1 -0
  78. burmesenlp-1.0.1/src/burmesenlp/corpus/tokenizer/evopiece_vocab.json +1 -0
  79. burmesenlp-1.0.1/src/burmesenlp/export/__init__.py +30 -0
  80. burmesenlp-1.0.1/src/burmesenlp/export/brat.py +119 -0
  81. burmesenlp-1.0.1/src/burmesenlp/export/conll.py +27 -0
  82. burmesenlp-1.0.1/src/burmesenlp/export/converter.py +289 -0
  83. burmesenlp-1.0.1/src/burmesenlp/export/exporter.py +92 -0
  84. burmesenlp-1.0.1/src/burmesenlp/export/importer.py +37 -0
  85. burmesenlp-1.0.1/src/burmesenlp/export/jsonl.py +166 -0
  86. burmesenlp-1.0.1/src/burmesenlp/export/labelstudio.py +81 -0
  87. burmesenlp-1.0.1/src/burmesenlp/export/offsets.py +53 -0
  88. burmesenlp-1.0.1/src/burmesenlp/export/schema.py +154 -0
  89. burmesenlp-1.0.1/src/burmesenlp/gazetteer/__init__.py +13 -0
  90. burmesenlp-1.0.1/src/burmesenlp/gazetteer/manager.py +428 -0
  91. burmesenlp-1.0.1/src/burmesenlp/gazetteer/models.py +24 -0
  92. burmesenlp-1.0.1/src/burmesenlp/gazetteer/types.py +47 -0
  93. burmesenlp-1.0.1/src/burmesenlp/grammar/__init__.py +76 -0
  94. burmesenlp-1.0.1/src/burmesenlp/lexicon/__init__.py +464 -0
  95. burmesenlp-1.0.1/src/burmesenlp/lexicon/data/default.json +24271 -0
  96. burmesenlp-1.0.1/src/burmesenlp/models/__init__.py +23 -0
  97. burmesenlp-1.0.1/src/burmesenlp/models/cache.py +26 -0
  98. burmesenlp-1.0.1/src/burmesenlp/models/loader.py +31 -0
  99. burmesenlp-1.0.1/src/burmesenlp/models/registry.py +37 -0
  100. burmesenlp-1.0.1/src/burmesenlp/mwe/__init__.py +13 -0
  101. burmesenlp-1.0.1/src/burmesenlp/mwe/engine.py +121 -0
  102. burmesenlp-1.0.1/src/burmesenlp/mwe/loader.py +344 -0
  103. burmesenlp-1.0.1/src/burmesenlp/mwe/matcher.py +20 -0
  104. burmesenlp-1.0.1/src/burmesenlp/mwe/models.py +49 -0
  105. burmesenlp-1.0.1/src/burmesenlp/mwe/trie.py +43 -0
  106. burmesenlp-1.0.1/src/burmesenlp/mwe/validator.py +29 -0
  107. burmesenlp-1.0.1/src/burmesenlp/normalize/__init__.py +57 -0
  108. burmesenlp-1.0.1/src/burmesenlp/pipeline/__init__.py +369 -0
  109. burmesenlp-1.0.1/src/burmesenlp/pipeline/document.py +139 -0
  110. burmesenlp-1.0.1/src/burmesenlp/postag/__init__.py +5 -0
  111. burmesenlp-1.0.1/src/burmesenlp/py.typed +1 -0
  112. burmesenlp-1.0.1/src/burmesenlp/sentences/__init__.py +5 -0
  113. burmesenlp-1.0.1/src/burmesenlp/structures/__init__.py +5 -0
  114. burmesenlp-1.0.1/src/burmesenlp/structures/token_trie.py +73 -0
  115. burmesenlp-1.0.1/src/burmesenlp/syllables/__init__.py +40 -0
  116. burmesenlp-1.0.1/src/burmesenlp/tag/__init__.py +41 -0
  117. burmesenlp-1.0.1/src/burmesenlp/tag/candidates.py +75 -0
  118. burmesenlp-1.0.1/src/burmesenlp/tag/disambiguator.py +61 -0
  119. burmesenlp-1.0.1/src/burmesenlp/tag/engine.py +37 -0
  120. burmesenlp-1.0.1/src/burmesenlp/tag/rule.py +59 -0
  121. burmesenlp-1.0.1/src/burmesenlp/tag/rules/__init__.py +33 -0
  122. burmesenlp-1.0.1/src/burmesenlp/tag/rules/ambiguity.py +159 -0
  123. burmesenlp-1.0.1/src/burmesenlp/tag/rules/base.py +90 -0
  124. burmesenlp-1.0.1/src/burmesenlp/tag/rules/conjunction.py +42 -0
  125. burmesenlp-1.0.1/src/burmesenlp/tag/rules/grammar.py +145 -0
  126. burmesenlp-1.0.1/src/burmesenlp/tag/rules/modifier.py +28 -0
  127. burmesenlp-1.0.1/src/burmesenlp/tag/rules/noun.py +70 -0
  128. burmesenlp-1.0.1/src/burmesenlp/tag/rules/verb.py +77 -0
  129. burmesenlp-1.0.1/src/burmesenlp/tokenize/__init__.py +89 -0
  130. burmesenlp-1.0.1/src/burmesenlp/tokenize/engine.py +54 -0
  131. burmesenlp-1.0.1/src/burmesenlp/tokenize/longest.py +126 -0
  132. burmesenlp-1.0.1/src/burmesenlp/tokenize/sentence.py +488 -0
  133. burmesenlp-1.0.1/src/burmesenlp/tokenize/syllable.py +129 -0
  134. burmesenlp-1.0.1/src/burmesenlp/tokenize/word.py +37 -0
  135. burmesenlp-1.0.1/src/burmesenlp/words/__init__.py +5 -0
  136. burmesenlp-1.0.1/src/burmesenlp/zawgyi/__init__.py +5 -0
  137. burmesenlp-1.0.1/src/burmesenlp/zawgyi/uni2zg_rules.json +322 -0
  138. burmesenlp-1.0.1/src/burmesenlp/zawgyi/zawgyi.py +127 -0
  139. burmesenlp-1.0.1/src/burmesenlp/zawgyi/zg2uni_rules.json +474 -0
  140. burmesenlp-1.0.1/src/burmesenlp.egg-info/PKG-INFO +148 -0
  141. burmesenlp-1.0.1/src/burmesenlp.egg-info/SOURCES.txt +161 -0
  142. burmesenlp-1.0.1/src/burmesenlp.egg-info/dependency_links.txt +1 -0
  143. burmesenlp-1.0.1/src/burmesenlp.egg-info/entry_points.txt +2 -0
  144. burmesenlp-1.0.1/src/burmesenlp.egg-info/requires.txt +13 -0
  145. burmesenlp-1.0.1/src/burmesenlp.egg-info/top_level.txt +1 -0
  146. burmesenlp-1.0.1/tests/test_architecture.py +46 -0
  147. burmesenlp-1.0.1/tests/test_chunking.py +372 -0
  148. burmesenlp-1.0.1/tests/test_clauses.py +249 -0
  149. burmesenlp-1.0.1/tests/test_corpus.py +60 -0
  150. burmesenlp-1.0.1/tests/test_custom_dictionary.py +57 -0
  151. burmesenlp-1.0.1/tests/test_export.py +210 -0
  152. burmesenlp-1.0.1/tests/test_gazetteer.py +196 -0
  153. burmesenlp-1.0.1/tests/test_golden_v1.py +109 -0
  154. burmesenlp-1.0.1/tests/test_lexicon.py +151 -0
  155. burmesenlp-1.0.1/tests/test_mwe.py +244 -0
  156. burmesenlp-1.0.1/tests/test_normalize.py +29 -0
  157. burmesenlp-1.0.1/tests/test_packaging_install.py +90 -0
  158. burmesenlp-1.0.1/tests/test_pipeline.py +187 -0
  159. burmesenlp-1.0.1/tests/test_postag.py +152 -0
  160. burmesenlp-1.0.1/tests/test_sentences.py +168 -0
  161. burmesenlp-1.0.1/tests/test_syllables.py +77 -0
  162. burmesenlp-1.0.1/tests/test_words.py +115 -0
  163. burmesenlp-1.0.1/tests/test_zawgyi.py +68 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,148 @@
1
+ Metadata-Version: 2.4
2
+ Name: burmesenlp
3
+ Version: 1.0.1
4
+ Summary: Production-oriented Myanmar (Burmese) NLP preprocessing: syllable, word and sentence segmentation, rule-based POS tagging, and phrase chunking.
5
+ Author: BurmeseNLP contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/aungthuhein2005/burmesenlp
8
+ Project-URL: Documentation, https://aungthuhein2005.github.io/burmesenlp/
9
+ Project-URL: Repository, https://github.com/aungthuhein2005/burmesenlp
10
+ Project-URL: Issues, https://github.com/aungthuhein2005/burmesenlp/issues
11
+ Project-URL: Changelog, https://github.com/aungthuhein2005/burmesenlp/blob/main/CHANGELOG.md
12
+ Keywords: myanmar,burmese,nlp,segmentation,pos-tagging,chunking
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Text Processing :: Linguistic
22
+ Requires-Python: >=3.9
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: PyYAML>=6.0
26
+ Provides-Extra: dev
27
+ Requires-Dist: pytest>=7.0; extra == "dev"
28
+ Requires-Dist: ruff>=0.4; extra == "dev"
29
+ Requires-Dist: mypy<2,>=1.8; extra == "dev"
30
+ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
31
+ Requires-Dist: build>=1.0; extra == "dev"
32
+ Provides-Extra: docs
33
+ Requires-Dist: mkdocs>=1.6; extra == "docs"
34
+ Requires-Dist: mkdocs-material>=9.5; extra == "docs"
35
+ Requires-Dist: mkdocstrings[python]>=0.26; extra == "docs"
36
+ Dynamic: license-file
37
+
38
+ # BurmeseNLP
39
+
40
+ Rule-based Myanmar (Burmese) NLP preprocessing: normalization, syllable / word /
41
+ sentence segmentation, POS tagging, phrase chunking, gazetteer NER, clause
42
+ parsing, and corpus export.
43
+
44
+ ## Install
45
+
46
+ ```bash
47
+ pip install burmesenlp
48
+ ```
49
+
50
+ Requires **Python 3.9+**. Runtime depends on **PyYAML**.
51
+
52
+ No dictionary path or model download is required.
53
+
54
+ ## Quick start
55
+
56
+ ```python
57
+ from burmesenlp import (
58
+ BurmeseNLP,
59
+ CorpusExporter,
60
+ process,
61
+ word_tokenize,
62
+ pos_tag,
63
+ zg2uni,
64
+ )
65
+ import json
66
+
67
+ # One-shot pipeline (returns a Document)
68
+ doc = process("စာပေကိုဖတ်သည်။သူကစားသည်။")
69
+ doc.words
70
+ doc.sentences
71
+ doc.pos_tags
72
+ doc.chunks
73
+ doc.entities # gazetteer NER (empty if no list hits)
74
+ doc.clauses # clause layer over phrases
75
+
76
+ # Document JSON
77
+ json.dumps(doc.to_dict(), ensure_ascii=False, indent=2)
78
+ ```
79
+
80
+ `Document` also supports dict-style access (`doc["words"]`).
81
+
82
+ ## Gazetteer NER & clauses
83
+
84
+ ```python
85
+ doc = process("ဒေါ်အောင်ဆန်းစုကြည် ရန်ကုန်ကို သွားသည်။")
86
+ for e in doc.entities:
87
+ print(e.text, e.entity_type)
88
+
89
+ for clause in doc.clauses:
90
+ print(clause.type, clause.text)
91
+
92
+ # Skip gazetteer matching
93
+ doc = process("...", gazetteer=False)
94
+ ```
95
+
96
+ ## Corpus export
97
+
98
+ ```python
99
+ from burmesenlp import CorpusExporter, process
100
+
101
+ doc = process("စာပေကိုဖတ်သည်။")
102
+ exporter = CorpusExporter()
103
+ print(exporter.to_jsonl(doc)) # also CoNLL / BRAT / Label Studio
104
+ ```
105
+
106
+ ## Stateful pipeline
107
+
108
+ ```python
109
+ from burmesenlp import BurmeseNLP
110
+
111
+ nlp = BurmeseNLP()
112
+ nlp.syllable_segment("မြန်မာစာပေ")
113
+ nlp.word_segment("ကျွန်တော်ကျောင်းသို့သွားသည်")
114
+ nlp.sentence_segment("စာပေကိုဖတ်သည်။သူကစားသည်။")
115
+ nlp.pos_tag(["ကျွန်တော်", "ကျောင်း", "သို့", "သွား", "သည်"])
116
+ ```
117
+
118
+ ## Helpers
119
+
120
+ ```python
121
+ from burmesenlp import word_tokenize, pos_tag, zg2uni
122
+
123
+ word_tokenize("ကျွန်တော်ကျောင်းသို့သွားသည်", engine="longest")
124
+ pos_tag(["ကျွန်တော်", "ကျောင်း"], engine="rule")
125
+ zg2uni("ျမန္မာစာေပ")
126
+ ```
127
+
128
+ ## Custom dictionary
129
+
130
+ ```python
131
+ from burmesenlp import BurmeseNLP
132
+
133
+ nlp = BurmeseNLP(dictionary_path="my_dict.json") # or .txt import
134
+ nlp.add_to_dictionary("နည်းပညာ", ["NOUN"])
135
+ nlp.save_dictionary("my_dict.json")
136
+ ```
137
+
138
+ Canonical JSON: `{ "word": ["tag1", "tag2"] }`. Tags must be from
139
+ `burmesenlp.POS_TAGS`.
140
+
141
+ ## CLI
142
+
143
+ ```bash
144
+ burmesenlp --mode words "ကျွန်တော်ကျောင်းသို့သွားသည်။"
145
+ burmesenlp --json --mode all "စာပေကိုဖတ်သည်။"
146
+ burmesenlp --mode zg2uni "ျမန္မာစာေပ"
147
+ ```
148
+
@@ -0,0 +1,205 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/aungthuhein2005/burmesenlp/main/docs/images/logo.png" alt="BurmeseNLP" width="180" />
3
+ </p>
4
+
5
+ # BurmeseNLP
6
+
7
+ **BurmeseNLP** (`burmesenlp`) is an open-source Python library for rule-based
8
+ Myanmar (Burmese) natural language processing.
9
+
10
+ Version **1.0** focuses on preprocessing: normalization, Zawgyi ↔ Unicode
11
+ **APIs**, syllable / word / sentence segmentation, multi-word expressions
12
+ (BMWE), lexicon management, rule-based POS tagging, phrase chunking,
13
+ gazetteer NER, clause parsing, and corpus export.
14
+ It is fast, dependency-light, and designed as the foundation for future
15
+ hybrid and machine-learning engines.
16
+
17
+ ```bash
18
+ pip install burmesenlp
19
+ ```
20
+
21
+ **Docs:** [https://aungthuhein2005.github.io/burmesenlp/](https://aungthuhein2005.github.io/burmesenlp/)
22
+ (source in [`docs/`](docs/); build with `pip install -e ".[docs]" && mkdocs serve`)
23
+
24
+ ```python
25
+ from burmesenlp import process
26
+
27
+ doc = process("ကျွန်တော်ကျောင်းသို့သွားသည်။")
28
+ print(doc["words"])
29
+ # ['ကျွန်တော်', 'ကျောင်း', 'သို့', 'သွား', 'သည်', '။']
30
+ ```
31
+
32
+ No dictionary path or model download is required.
33
+
34
+ ## Features
35
+
36
+ - **Normalization** — strip zero-width characters, Unicode NFC
37
+ - **Zawgyi ↔ Unicode** — conversion rules plus a heuristic detector
38
+ - **Syllable tokenization** — sylbreak-style boundaries
39
+ - **Word segmentation** — dictionary longest-match (`engine="longest"`)
40
+ - **Sentence segmentation** — grammar-aware (after POS + phrase chunks)
41
+ - **Multi-word expressions** — BMWE trie merge (idioms)
42
+ - **Lexicon** — bundled tagged vocabulary (~24k entries) + mergeable custom JSON/txt
43
+ - **POS tagging** — rule / lexicon-based (`engine="rule"`)
44
+ - **Gazetteer NER** — list-based entities (`doc.entities`; PERSON / TOWN / …), on by default
45
+ - **Phrase chunking** — YAML-driven NP / VP / PP / … (entity spans locked as NP)
46
+ - **Clause parsing** — MAIN / PURPOSE / … over phrases (`doc.clauses`)
47
+ - **Corpus export** — JSONL / CoNLL / BRAT / Label Studio via `CorpusExporter`
48
+ - **Pipeline API** — `process(text)` and stateful `BurmeseNLP`
49
+ - **CLI** — `burmesenlp` console script
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install burmesenlp
55
+ ```
56
+
57
+ From a clone (development):
58
+
59
+ ```bash
60
+ pip install -e ".[dev]"
61
+ ```
62
+
63
+ Requires **Python 3.9+**. Runtime depends on **PyYAML** (phrase grammar); there
64
+ are no other third-party NLP dependencies.
65
+
66
+ ## Quick start
67
+
68
+ ```python
69
+ from burmesenlp import (
70
+ BurmeseNLP,
71
+ CorpusExporter,
72
+ process,
73
+ word_tokenize,
74
+ pos_tag,
75
+ zg2uni,
76
+ )
77
+ import json
78
+
79
+ # One-shot pipeline (returns a Document)
80
+ doc = process("စာပေကိုဖတ်သည်။သူကစားသည်။")
81
+ doc.words
82
+ doc.sentences
83
+ doc.pos_tags
84
+ doc.chunks
85
+ doc.entities # gazetteer NER (empty if no list hits)
86
+ doc.clauses # clause layer over phrases
87
+
88
+ # Document JSON
89
+ json.dumps(doc.to_dict(), ensure_ascii=False, indent=2)
90
+
91
+ # Gazetteer NER (default on; skip with gazetteer=False)
92
+ doc = process("ဒေါ်အောင်ဆန်းစုကြည် ရန်ကုန်ကို သွားသည်။")
93
+ for e in doc.entities:
94
+ print(e.text, e.entity_type)
95
+
96
+ # Clause parse
97
+ for clause in doc.clauses:
98
+ print(clause.type, clause.text)
99
+
100
+ # Corpus export (JSONL / CoNLL / BRAT / Label Studio)
101
+ exporter = CorpusExporter()
102
+ print(exporter.to_jsonl(doc))
103
+
104
+ # Stateful pipeline
105
+ nlp = BurmeseNLP()
106
+ nlp.syllable_segment("မြန်မာစာပေ")
107
+ nlp.word_segment("ကျွန်တော်ကျောင်းသို့သွားသည်")
108
+ nlp.sentence_segment("စာပေကိုဖတ်သည်။သူကစားသည်။")
109
+ nlp.pos_tag(["ကျွန်တော်", "ကျောင်း", "သို့", "သွား", "သည်"])
110
+
111
+ # Helpers
112
+ word_tokenize("ကျွန်တော်ကျောင်းသို့သွားသည်", engine="longest")
113
+ pos_tag(["ကျွန်တော်", "ကျောင်း"], engine="rule")
114
+ zg2uni("ျမန္မာစာေပ")
115
+ ```
116
+
117
+ ### Custom dictionary
118
+
119
+ `BurmeseNLP()` loads bundled `lexicon/data/*.json` merged with closed-class
120
+ seed lists. Extra files **merge** onto that default (per-word tag union).
121
+ Missing or malformed files raise `LexiconError` — there is no silent fallback.
122
+
123
+ ```python
124
+ nlp = BurmeseNLP(dictionary_path="my_dict.json") # or .txt import
125
+ nlp.add_to_dictionary("နည်းပညာ", ["NOUN"])
126
+ nlp.save_dictionary("my_dict.json") # atomic JSON write
127
+ ```
128
+
129
+ **Canonical JSON:** `{ "word": ["tag1", "tag2"] }`
130
+
131
+ **Import** `.txt`**:** `word<TAB>tag1,tag2`
132
+
133
+ Tags must be from `burmesenlp.POS_TAGS`. To load a file *instead of* the
134
+ bundled default, use `BurmeseNLP(lexicon=Lexicon.from_file(path))`.
135
+
136
+ ### CLI
137
+
138
+ ```bash
139
+ burmesenlp --mode words "ကျွန်တော်ကျောင်းသို့သွားသည်။"
140
+ burmesenlp --json --mode all "စာပေကိုဖတ်သည်။"
141
+ burmesenlp --mode zg2uni "ျမန္မာစာေပ"
142
+ ```
143
+
144
+ ## Module overview
145
+
146
+ | Module | Role |
147
+ | ----------- | ---------------------------------------------- |
148
+ | `pipeline` | `BurmeseNLP`, `process()`, `Document` |
149
+ | `normalize` | NFC / zero-width / Zawgyi heuristic |
150
+ | `zawgyi` | `uni2zg` / `zg2uni` / `to_unicode` |
151
+ | `tokenize` | syllable, word (`longest`), sentences |
152
+ | `mwe` | BMWE multi-word expression merge |
153
+ | `tag` | rule-based POS |
154
+ | `gazetteer` | list-based NER → `Document.entities` |
155
+ | `chunking` | phrase chunks + clause parse |
156
+ | `export` | `CorpusExporter` / `CorpusImporter` |
157
+ | `lexicon` | dictionary load / merge / save |
158
+ | `grammar` | closed-class lists |
159
+ | `cli` | console entry point |
160
+
161
+ See [STRUCTURE.md](STRUCTURE.md) for the full layout and the
162
+ [documentation site](https://aungthuhein2005.github.io/burmesenlp/) for guides
163
+ and API reference. Corpus trees under `corpus/` hold V1 grammar/idioms/gazetteers
164
+ plus scaffolds for later versions.
165
+
166
+ ## Current limitations
167
+
168
+ Version 1 is **rule-based only**:
169
+
170
+ - No machine learning, Transformers, CRF, or embeddings
171
+ - No SentencePiece / BPE / EvoPiece tokenizers
172
+ - NER is **gazetteer / list-based only** (not statistical or neural); coverage
173
+ is limited to bundled entity lists, and short place names need locative cues
174
+ - No sentiment analysis or spell checking
175
+ - Word segmentation quality depends on lexicon coverage; longest-match may
176
+ prefer compounds present in the dictionary
177
+ - POS and chunk rules are heuristic — expect residual tagging/chunk errors
178
+ - Zawgyi *detection* is heuristic — prefer explicit `zg2uni` when encoding
179
+ is known
180
+ - `process()` **does not auto-convert Zawgyi.** It only runs `normalize()`
181
+ (NFC / zero-width). Convert first:
182
+
183
+ ```python
184
+ from burmesenlp import zg2uni, process
185
+
186
+ doc = process(zg2uni(zawgyi_text))
187
+ ```
188
+
189
+ These gaps are intentional for a lightweight, deterministic V1.
190
+
191
+ ## Contributing
192
+
193
+ See [CONTRIBUTING.md](CONTRIBUTING.md), [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md),
194
+ and [SECURITY.md](SECURITY.md).
195
+ Please keep V1 PRs focused on rule-based quality, packaging, docs, and tests —
196
+ do not add unfinished ML features to the public API.
197
+
198
+ ## License
199
+
200
+ Apache-2.0 — see [LICENSE](LICENSE).
201
+
202
+ ## References
203
+
204
+ - Ye Kyaw Thu et al., myPOS / sylbreak conventions for Myanmar NLP
205
+ - Rabbit Converter–style Zawgyi ↔ Unicode rule tables
@@ -0,0 +1,111 @@
1
+ # BurmeseNLP
2
+
3
+ Rule-based Myanmar (Burmese) NLP preprocessing: normalization, syllable / word /
4
+ sentence segmentation, POS tagging, phrase chunking, gazetteer NER, clause
5
+ parsing, and corpus export.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pip install burmesenlp
11
+ ```
12
+
13
+ Requires **Python 3.9+**. Runtime depends on **PyYAML**.
14
+
15
+ No dictionary path or model download is required.
16
+
17
+ ## Quick start
18
+
19
+ ```python
20
+ from burmesenlp import (
21
+ BurmeseNLP,
22
+ CorpusExporter,
23
+ process,
24
+ word_tokenize,
25
+ pos_tag,
26
+ zg2uni,
27
+ )
28
+ import json
29
+
30
+ # One-shot pipeline (returns a Document)
31
+ doc = process("စာပေကိုဖတ်သည်။သူကစားသည်။")
32
+ doc.words
33
+ doc.sentences
34
+ doc.pos_tags
35
+ doc.chunks
36
+ doc.entities # gazetteer NER (empty if no list hits)
37
+ doc.clauses # clause layer over phrases
38
+
39
+ # Document JSON
40
+ json.dumps(doc.to_dict(), ensure_ascii=False, indent=2)
41
+ ```
42
+
43
+ `Document` also supports dict-style access (`doc["words"]`).
44
+
45
+ ## Gazetteer NER & clauses
46
+
47
+ ```python
48
+ doc = process("ဒေါ်အောင်ဆန်းစုကြည် ရန်ကုန်ကို သွားသည်။")
49
+ for e in doc.entities:
50
+ print(e.text, e.entity_type)
51
+
52
+ for clause in doc.clauses:
53
+ print(clause.type, clause.text)
54
+
55
+ # Skip gazetteer matching
56
+ doc = process("...", gazetteer=False)
57
+ ```
58
+
59
+ ## Corpus export
60
+
61
+ ```python
62
+ from burmesenlp import CorpusExporter, process
63
+
64
+ doc = process("စာပေကိုဖတ်သည်။")
65
+ exporter = CorpusExporter()
66
+ print(exporter.to_jsonl(doc)) # also CoNLL / BRAT / Label Studio
67
+ ```
68
+
69
+ ## Stateful pipeline
70
+
71
+ ```python
72
+ from burmesenlp import BurmeseNLP
73
+
74
+ nlp = BurmeseNLP()
75
+ nlp.syllable_segment("မြန်မာစာပေ")
76
+ nlp.word_segment("ကျွန်တော်ကျောင်းသို့သွားသည်")
77
+ nlp.sentence_segment("စာပေကိုဖတ်သည်။သူကစားသည်။")
78
+ nlp.pos_tag(["ကျွန်တော်", "ကျောင်း", "သို့", "သွား", "သည်"])
79
+ ```
80
+
81
+ ## Helpers
82
+
83
+ ```python
84
+ from burmesenlp import word_tokenize, pos_tag, zg2uni
85
+
86
+ word_tokenize("ကျွန်တော်ကျောင်းသို့သွားသည်", engine="longest")
87
+ pos_tag(["ကျွန်တော်", "ကျောင်း"], engine="rule")
88
+ zg2uni("ျမန္မာစာေပ")
89
+ ```
90
+
91
+ ## Custom dictionary
92
+
93
+ ```python
94
+ from burmesenlp import BurmeseNLP
95
+
96
+ nlp = BurmeseNLP(dictionary_path="my_dict.json") # or .txt import
97
+ nlp.add_to_dictionary("နည်းပညာ", ["NOUN"])
98
+ nlp.save_dictionary("my_dict.json")
99
+ ```
100
+
101
+ Canonical JSON: `{ "word": ["tag1", "tag2"] }`. Tags must be from
102
+ `burmesenlp.POS_TAGS`.
103
+
104
+ ## CLI
105
+
106
+ ```bash
107
+ burmesenlp --mode words "ကျွန်တော်ကျောင်းသို့သွားသည်။"
108
+ burmesenlp --json --mode all "စာပေကိုဖတ်သည်။"
109
+ burmesenlp --mode zg2uni "ျမန္မာစာေပ"
110
+ ```
111
+