syllable, word, sub_word and phrase segmenter for Burmese (Myanmar language)
- Introduction
- Rule: Syllable Segmentation with Regular Expression
- Syllable Segmentation with "myWord" Segmentation Tool
- Theory: Word Segmentation with Viterbi Algorithm
- Building Unigram, Bigram Dictionaries for Word Unit
- Word Segmentation with "myWord" Segmentation Tool
- Theory: Unsupervised Phrase Segmentation with NPMI
- Phrase Segmentation with "myWord" Segmentation Tool
- Command-line Help
- Introduction to "npmi_train" Option
- Dictionaries for Word and Phrase Segmentation
- Files and Folder Information
- Evaluation of myWord for "Word Segmentation"
- Commands of myWord Segmentation Tool
- Contributors
- To Do
- License
- Citation
- Reference
ááŒááºáá¬á ᬠá á¬áá¯á¶ážááœá±ááᯠáá±á«á·áá±á«á·áá«ážáá«ážáá²á· ááŒááºááŒááºáááºááẠááŒááºáá±ážááá¯ááºááŒá®ážá library ááœá± á¡áá»á¬ážááŒá®ážááá¯áááºáž ááŸá®ááá±áá² Developer ááœá±á ááœááºááœááºáá°áá° embedding áá¯ááºááá¯ááºááŒá®ážáá±á¬á· ááá¯ááºá·áá±áá¬áá²á·ááá¯ááºáááºáž extend áá¯ááºááá¯ááºáá²á· word segmentation tool á áá®áá±á·á¡áá áááŸááá±ážáá°ážááá¯á· áá¬ážáááºáá¬ážáááºá á¡á²áá® ááœááºáááºááá¯ááŒááºá·ááá¯ááºááá¯á·áááºááœááºááŒá®ážáá±á¬á· myWord ááᯠR&D áá¯ááºáá²á·ááŒá®áž release áá¯ááºáá±ážááá¯ááºáá«áááºá
myWord Segmentation Tool ááᯠáá¯á¶ážááŒá®ážáá±á¬á· ááŒááºáá¬á á¬ááŒá±á¬ááºážááœá±ááᯠ"syllable unit", "sub_word", "word unit", "phrase unit" ááœá± á¡ááŒá ẠááŒááºáá±ážáá²á· áááá¯ááááºáá«á NLP preprocessing/post-editing á¡áá¯ááºááœá±á ááŒááºáá¬á á¬áá²á· áááºáááºáá²á· áá±áá¬ááœá±ááᯠá á¬áá¯á¶ážááŒááºááŒá®áž model áá±á¬ááºááá¯á·á¡ááœáẠá¡áá¯á¶ážáááºáá«ááááºá·áááºá
myWord Segmentation Tool á á¡ááá áá¯ááºáá±ážááá¯ááºáá²á· á¡áá»ááºááœá±ááá¯áá±á¬á· á¡ááºá¹áááááºááá¯áá² áá»áá±ážáá±ážááá¯ááºáááºá
- Written with Python programming (so... you can hack easily)
- Used unigram, bigram dictionaries built with "manually segmented twelve million words" training corpus (myWord Corpus Ver. 1.0)
- Yes, myWord supports "syllable", "sub_word", "word" and "phrase" segmentation
- Of course, you can train or build unigram, bigram dictionaries with your segmented corpus
- By default, running word segmentation with Viterbi Algorithm
- By default, running phrase segmentation with NPMI (Normalized Pointwise Mutual Information) Algorithm
- Shared Burmese unigram, bigram dictionaries with MIT License
ááŒááºáá¬á á¬á¡ááœáẠsyllable segmentation á á¡áá±ážááŒá®ážáá²á· word segmentation unit áá áºáá¯áá«á á¡áá°ážáááŒááºá· áá±áá¬á áá±á¬ááºážáá±á¬ááºážáááŸááá¬ááŒá±á¬ááºá·áá±á¬á ááŒáááºáá²á· word segmenter á áááŸááá¬ááŒá±á¬ááºá·áá±á¬ Machine Translation áá¯áá±ááááŸá¬ááá¯ááẠsyllable segmentation ááŒááºááŒá®ážáá±á¬á· áá¬áá¬ááŒááºáá¬á word segmentation áá¯ááºááŒá®áž training áá¯ááºáá¬áááºáá±á¬áẠááááºááœá±á ááá¯áá±á¬ááºážááá¯ááºááŒá±á¬ááºážááᯠá á¬áááºážááœá±áá±ážááŒá®ážáááºáž áááºáá±ááŒáá²á·ááŒá®ážáá«ááŒá®á myWord Segmentation Tool ááŸá¬áááºáž syllable breaking áá¯ááºáá±ážáá²á· option ááá¯áááºá·áá¬ážáá«áááºá
Syllable breaking ááá¯áááºáž Finite State Model áá±á¬ááºááŒá®ážááŒááºáá¬áá»áá¯ážá syllable list á¡áááá¬ááºáá±á¬ááºááŒá®áž ááŒááºáá¬áá»áá¯áž á
áááºááŒááºá· approach á¡áá»áá¯ážáá»áá¯ážáá²á· ááœá¬ážááá¯á·ááá±áá²á· 2014 áá±á¬ááºááŸá¬ propose áá¯ááºáá²á·áá²á· sylbreak (Link: https://github.com/ye-kyaw-thu/sylbreak) áá²á Regular Expression (RE) ááá¯áá² áá¯á¶ážáá¬ážáá«áááºá áá¬ááŒá±á¬ááºá·áá²ááá¯ááẠUnicode áá²á· á
á¬ááá¯ááºáá¬ážáá²á· ááŒááºáá¬á
á¬ááœá±á¡ááœááºá RE áá
áºááŒá±á¬ááºážáááºážáá²á· ááŸááŸáá á¡áá¯ááºáá¯áẠáá±ážááá¯á·áá«á ááŒá®ážáá±á¬á· NLP á¡áá¯ááºááœá± á¡áá»á¬ážááŒá®ážá¡ááœááºáááºáž áááºááŸá syllable breaking RE áááºááŸááºáá»ááºáá²á·ááẠá¡áááºááŒá±ááá¯á·áá«á Python code áá²á·áá² á¡ááœááºááŸááºážááŒááááºáá±á¬á· á¡á±á¬ááºáá«á¡ááá¯ááºáž áá»ááºáž (á-á¡)á á¡ááºá¹áááááºá
á¬áá¯á¶ážáá²á· á¡ááºá¹áááááºááááºáž (a-z,A-Z,0-9)á áááŒá¬ážá
á¬áá¯á¶áž (á£á€á¥áŠááá¯á·ááᯠááááœá±á ááŒááºáá¬ááááºážá áááºá¹áá±áááá»áá¯á·)á áá«ááºááá·áº áááºá·áá²á· Unicode áááºá¹áá±á áá²á· á¡áááºá¡áá¹ááᬠá
á¯á
á¯áá±á«ááºáž variable áá«ážáá¯ááᯠáááºááŸááºááá¯ááºááŒá®ážááẠ((?<!" + ssSymbol + r")["+ myConsonant + r"](?![" + aThat + ssSymbol + r"])" + r"|[" + enChar + otherChar + r"])
ááá¯áá²á· RE ááᯠpass áá¯ááºáá±ážááá¯ááºáá¯á¶áá«áá²á áá® RE á áá±ážáá¬ážáá²á· Rule ááá±á¬á· áá«ááºááá·áº áááºá·áá²á· áááºá¹áá±á áá±á¬ááºá ááá¯ááºáá²á· áá»ááºáž ááá¯ááºáááºá ááŒá®ážáá±á¬á· á¡áááºáá²á·ááœá²áá±áá²á· áá»ááºáž ááá¯ááºááẠá¡á²áá®áá»ááºáž á
á¬áá¯á¶ážáá²á· ááŸá±á·ááŸá¬ break point áá¯ááºáá«á ááá¯á·ááá¯áẠá¡ááºá¹áááááºá
á¬áá¯á¶ážááá¯á· otherChar á¡áá±áá²á· áááºááŸááºáá¬ážáá²á· á
á¬áá¯á¶ážááœá± ááá¯áááºáááºáž á¡á²áá®á
á¬áá¯á¶ážááœá±áá²á· ááŸá±á·ááŸá¬ break áááºá·áá«ááá¯á· áááºááŸááºáá¬ážáᬠááŒá
áºáá«áááºá
myConsonant = r"á-á¡"
enChar = r"a-zA-Z0-9"
otherChar = r"á£á€á¥áŠá§á©áªá¿áááá-ááá!-/:-@[-`{-~\s"
ssSymbol = r'á¹'
aThat = r'áº'
#Regular expression pattern for Myanmar syllable breaking
#*** a consonant not after a subscript symbol AND a consonant is not followed by a-That character or a subscript symbol
BreakPattern = re.compile(r"((?<!" + ssSymbol + r")["+ myConsonant + r"](?![" + aThat + ssSymbol + r"])" + r"|[" + enChar + otherChar + r"])", re.UNICODE)
input file á á¡á±á¬ááºáá«á¡ááá¯ááºážááŸááááºááá¯á· ááá¯ááŒáá«á áá¯á·...
$ cat test.txt
áá»áœááºáá±á¬áºááá¯áá±ááááá¬ážáá«á
áá±á·áá±á¬ááá±á¬ááŒááºáá¬á
á¬áá²á·ááœááºáá»á°áá¬áá²á·áá²á¡áá¯áẠáá»á¬áž áá« áááº
áááºážááá±á¬áá¬á¡áá¯ááºáá¯ááºáá¬áá²á
ááŒá±á¬ááŒáá«á¡á¯á¶áž
áá±á¬áá®áááºážáááºáá±á¬ááºáá»ááºáááºááŒá±á¬ááœá¬
ááá¹ááá±ážááŸá¬áá±á«áºá¡á±á¬ááºáááºážá
á¯ááŒááºááááºá·ááœááºážááŒá±á¬áááºáá²á·á
syllable segmentation áá¯ááºááá¯á·á¡ááœááºá command line argument ááᯠsyllable ááá¯á· áá±ážááŒá®ážáá±á¬áẠ<input-file> áá²á· <output-file> ááœá±áá²á· áá¬áááºááœá±ááᯠááá¯ááºáááºá·áá±ážááá¯ááºáá¯á¶áá«áá²á
$ python ./myword.py syllable ./test.txt ./test.syllable
$ cat ./test.syllable
áá»áœáẠáá±á¬áº á áᯠáá± á á á áá¬áž áá« á
áá±á· áá±á¬ á áá±á¬ ááŒáẠáᬠá
ᬠáá²á· ááœáẠáá»á° áᬠáá²á· áá² á¡ áá¯áẠáá»á¬áž áá« áááº
áááºáž á áá±á¬ áᬠᡠáá¯áẠáá¯áẠáᬠáá² á
ááŒá±á¬ áጠáá« á¡á¯á¶áž
áá±á¬ áá® áááºáž ááẠáá±á¬áẠáá»áẠááẠááŒá±á¬ ááœá¬
ááá¹á áá±áž ááŸá¬ áá±á«áº á¡á±á¬áẠáááºáž á
ᯠááŒáẠááááºá· ááœááºáž ááŒá±á¬ ááẠáá²á· á
áááºááŸá áá¬ážááŸááºáž myWord áá²á· word segmentation áá¯ááºáá¯á¶ááá±á¬á· áááºáá²á· á á¬áá¯á¶ážáá áºáá¯á¶ážáá»ááºážá á® áá±áá±áá»á¬áá»á¬ ááŒááºáá¬ážáá²á· á á¬ááŒá±á¬ááºážáá± á ááááºážáá»á±á¬áºá á á¬áá¯á¶ážáá± áááááºážáá»á±á¬áºááŸááá²á· training corpus ááá± ááááá¯á¶áž ngram á¡áááá¬ááºááŸá áºáᯠ(unigram, bigram) ááᯠááŒáá¯áááºáááºáá±á¬ááºáá¬ážááŒá®ážáá±á¬á· Viterbi algorithm áá²á· decoding áá¯ááºáá²á· approach ááᯠá¡áá¯á¶ážááŒá¯áá¬ážáá«áááºá áááºážáááºáž á¡áá±ážá ááẠááŒááºá·ááŒá±á¬áááẠinput áááºáá¬áá²á· á á¬ááŒá±á¬ááºážáá²á· character áá áºáá¯á¶ážáá»ááºážá á®ááᯠbigram, unigram áá±á¬áºáááºááŸá áºáá¯áá²á· score áá¯ááºááœá¬ážááŒá®ážáá±á¬á·á á¡ááŒá áºááá¯ááºáá¯á¶áž á á¬áá¯á¶ážááœá² ááᯠViterbi algorithm ááá¯áá¯á¶ážááŒá®ážáá±á¬á· ááœá±ážáá²á· áááºážáááºážáá«á Score áá¯ááºáá²á·á¡áá«ááŸá¬ á¡áááºáá¯á¶áž bigram á¡áááá¬ááºááŸá¬ ááŸáááẠá¡á²áá® Probability ááᯠáá°ááŒá®ážáá±á¬á·á bigram á¡áááá¬ááºááŸá¬ á¡á²áá® á á¬áá¯á¶ážááœá²á ááŸá¬áááœá±á·áááºáá±á¬á· unigram á¡áááá¬ááºá probability ááᯠáá°áá«áááºá
Viterbi Algorithm á 1967 ááŸá¬ Andrew J. Viterbi ááá¯áá²á· á¡ááºáá»ááºáá®áá¬á propose áá¯ááºáá²á·áá²á· algorithm áá«á áá® algorithm á Dynamic Programming Algorithm á¡á¯ááºá
á¯áá²ááŸá¬ áá«ááŒá®ážáá±á¬á· Automatic Speech Recognition (ASR), Data recording, Part-Of-Speech (POS) tagging, DNA sequencing, Space Communication á
áááºááŒááºá· á§áááá¬áá»áá¯ážá
á¯á¶ááŸá¬ á¡áá¯á¶ážááŒá¯áá±ááŒáá«áááºá áá»áœááºáá±á¬áºááá¯á· áá±á·á
áẠá¡áá¯á¶ážááŒá¯áá±áá²á· ááá¯ááá¯ááºážáá¯ááºážáááºááœááºááŸá¯ááœá±ááŸá¬áááºáž Viterbi algorithm ááᯠáá¯á¶ážáá¬ážáá«áááºá á¡á²áá«ááŒá±á¬ááºá· ááœááºáá²á·áá²á· ááŸá
áºáá±á«ááºáž á
á á¡ááœááºážááŸá¬ ááááºááᯠáá¬áááºááŒá®ážáá²á· algorithm áá
áºáá¯ááŒá
áºááŒá®áž áááºááœá±á· áááá¬ážáááºáááºáž ááá¯ááºá·á¡áá¯ááºááœá±á¡ááœáẠá¡áá¯á¶ážáááºáá¬ááá¯á· ááœááºáá»á°áá¬ááá¬ážááœá±á á¡ááºáá»ááºáá®áá¬ááœá±á¡áá±áá²á·á ááááááŒá
áºááá¯á·ááᯠááŒá±á¬ááá«ááááºá·áááºá ááááºáááºáž á¡áá±ážá
ááẠáá±á·áá¬áá»ááºáá²á· áá°ááœá±á áá°áá²á· áááºá
ááºáá±áá²á· Markov Process, Markov Property, Markov Chain, Hidden Markov Model (HMM) ááá¯á·ááᯠá¡áááºáá±á·áá¬áá«ááá¯á· á¡ááŒá¶áá±ážáá»ááºáá«áááºá á¥ááᬠáá
áºáá¯á¡áá±áá²á· Viterbi áá²á· á¡áá¯ááºáá¯ááºáá¯á¶ááᯠááŒá±á¬ááááº... ááá¯ááŒáá«á
áá¯á· áá»áœááºáá±á¬áºááá¯á·ááŸá¬ HMM POS tagging áá¯ááºáá±ážáá²á· HMM áá±á¬áºáááºá áá±á¬ááºáá¬ážááŒá®ážáá¬ážááá¯ááẠá
á¬ááŒá±á¬ááºáž á¡áá
áºáá
áºááŒá±á¬ááºážááᯠá¡á²áá® HMM áá±á¬áºáááºááᯠpass áá¯ááºááŒá®ážáá±á¬á· POS tagging áá¯ááºááá¯ááºážáá²á·á¡áá«ááŸá¬ á
á¬ááŒá±á¬ááºáž áá²ááŸá¬ áá«áá²á· á
á¬áá¯á¶áž á¡áá±á¡ááœááºáá±á«áºááᯠáá°áááºááŒá®ážáá±á¬á· ááŒá
áºááá¯ááºáá»á±ááŸááá²á· tag sequence ááœá±á á¡áá»á¬ážááŒá®ážááá¯á·ááá¯á· á¡ááŒá
áºááá¯ááºáá¯á¶ážáá±á¬ POS tag sequence ááᯠáá±á¬áºáááºá predict áá¯ááºáá²á· á¡áá«áá»áá¯ážááŸá¬ Viterbi ááᯠáá¯á¶ážááŒá®áž best path ááᯠááŸá¬ááá¯á· ááá«áááºá á¡á²áá®ááᯠááá¯ááºáá² brute force searching áá²á· ááŸáááá»áŸ path á¡áá¯ááºááá¯ááœááºááŒá®ážááŸáᬠááœá±ážáááºááá¯ááŒá®áž á
ááºážá
á¬ážááẠááœááºáá»á°áᬠmemory á áááá¯ááºáá«áá°ážá áá¬ááŒá±á¬ááºá·áá²ááá¯áá±á¬á· ngram á¡áááá¬ááºá¡ááŒááºá HMM ááŸá¬á Observed state áá²á· Hidden state ááá¯ááŒá®áž ááŸá
áºááá¯ááºážáá«áá¬ááŒá±á¬ááºá· áá»áœááºáá±á¬áºááá¯á·á transition probability (POS-tag áá
áºáá¯áá²á· áá
áºáá¯á¡ááŒá¬áž) áá±á¬ emmission probability (POS-tag áá²á· word á¡ááŒá¬áž) áá±á¬ ááᯠááœááºááŒáááŸá¬ááá¯á· á
á¬áá¯á¶ážá¡áá±á¡ááœááºá áá»á¬ážáá¬áá¬áá²á· á¡áá»áŸ operation á exponentially ááá¯ážáá¬ááŸá¬ááá¯á·áá«á ááœááºáá»á°áá¬ááá¬ážááœá± á¡áá»á¬ážá
ᯠáááá¬ážááŒáá²á· Computational Complexity á¡áá±áá²á· ááŒááºá·áááºááá¯ááẠBrute Force algorithm á O(S^T)
ááŒá
áºááŒá®ážáá±á¬á· Viterbi algorithm á O(T*S^2)
ááá¯á· áá±á¬áºááŒááá¯á· ááá«áááºá áá®áá±áá¬ááŸá¬ ááŒá±á¬áá±áá²á· "S" á HMM network áá²ááŸá¬ ááŸááá±áá²á· state á¡áá±á¡ááœáẠ(i.e. the number of states) ááᯠááá¯ááºá
á¬ážááŒá¯ááŒá®ážáá±á¬á·á "T" ááá±á¬á· á
á¬ááŒá±á¬ááºáž áá
áºááŒá±á¬ááºážááŸá¬ ááŸááá²á· á
á¬áá¯á¶ážá¡áá±á¡ááœáẠ(i.e. the length of the data sequence) ááᯠááá¯ááºá
á¬ážááŒá¯áá¬ááŒá±á¬ááºá· Viterbi Algorithm á computational cost ááᯠá¡áá»á¬ážááŒá®áž áá»á±á¬á·ááœá¬ážá
á±áá«áááºá
Word segmentation á¡áá¯ááºááá¯áááºáž graph á¡áá±áá²á· ááŒááºááŒááºá·ááŒá®áž á ááºážá á¬ážááŒááºá·ááŒáá¡á±á¬ááºá ááŸááºážááŒááᬠááœááºáá°á¡á±á¬ááºááá¯á· input á á¬ááŒá±á¬ááºážááᯠááŒááºáá¬á á¬áá¯á¶áž "ááá¬á" ááá¯áá²á· á á¬áá¯á¶áž ááŸá áºáá¯á¶ážáá«áá²á· á áá¬ážá á¯áá±ážááá¯áá² á¥ááá¬áá¯á¶ážááŒá®ážáá±á¬á· ááŸááºážááŒáá«áááºá áááºáá¬áá²á· á á¬ááŒá±á¬ááºážááᯠcharacter áá áºáá¯á¶ážáá»ááºážá á® ááŒááºááŒá®ážáá±á¬á· node áá áºáá¯áá»ááºážá á®á¡ááœáẠprobability ááœá±ááᯠááœááºááŒá®áž break point ááᯠá ááºážá á¬ážáá²á· áá±áá¬ááŸá¬ Brute force áá²á·áá¬ááá¯ááẠnode á¡áá¯ááºááᯠááœááºááŒá®ážá០final word boundary ááᯠáá¯á¶ážááŒááºááá¯ááºááŸá¬ ááŒá áºáá«áááºá ááá¯á·áá±á¬áº Viterbi algorithm áá²á· á¡áá¯ááºáá¯ááºáá¯á¶ááá±á¬á· memory ááŸá¬ ááŸá±á·á ááœááºáá²á·áá²á· node áá áºáá¯áá»ááºážá á®á¡áá probability distribution ááᯠááŸááºáá¬ážáá¬ážááŒá®ážáá±á¬á· áááºážáááẠnode ááá±áá¬áá¬ááŸá¬ áááºááŸá á¡áá»áááºá¡áá ááœááºáá²á·áá²á· ááááºááœá±áá²ááá± áááá¯á¡ááºáá±á¬á·áá²á· path ááœá±ááᯠááŒá¯ááºáá»áá¬ážáá²á·ááŒá®áž ááŒá áºááá¯ááºáá»á±á¡ááŸááá¯á¶áž best path ááá¯áá² áááºá·áááºá·ááŒá®áž á¥á®ážáááºááœááºááœá¬ážáá²á· áá¯á¶á á¶áá«á Algorithm á¡áá±áá²á· á¡áá¯ááºáá¯ááºáá¯á¶ááᯠáááááá»áá» ááŒá±á¬ááááºáá±á¬á· forward order áá²á· backward order ááá¯ááŒá®ážáá±á¬á· ááŸá áºááá¯ááºážáá«áááºááŒá®ážá forward ááŸá¬á node áá áºáá¯áá»ááºážá á®ááᯠáá±á¬ááºááá¯á·á¡ááœáẠáá¬áá²á· best path ááœá±ááᯠááœááºááœá¬ážáá«áááºá Backward order á¡ááá¯ááºážááá±á¬á· á á¬ááŒá±á¬ááºáž á¡á ááá± á¡áá¯á¶ážá¡áá best path ááᯠáá±á¬ááºááœá¬ážáá²á· áá¯á¶á á¶áá«á Backward operation áá²á· calculation áá¯ááºáá²á·áá¯á¶á á¶ááá±á¬á· á á¬ááŒá±á¬ááºážá¡áá¯á¶ážááá± á á¬ááŒá±á¬ááºážááŸá±á·áá¯á¶ážááᯠááŒá±á¬ááºážááŒáẠááŒááºááœá¬ážáá²á· áá¯á¶á á¶áá²á·ááœááºáá«áááºá á¡á²áá«ááŒá±á¬ááºá·ááá¯á·ááá¯á·áááºáž Backward ááá¯á·áá¯á¶ážáá¬áá«á
ááááá¯á¶áž áá±á·áá¬áá²á·áá°ááœá±á¡ááœááºá follow ááá¯ááºááá¯á· áááºááá¯ááºáá¬ááŒá±á¬ááºá· "ááá¬á" ááá¯áá²á· á á¬ááŒá±á¬ááºážááá¯á·áá±ážááá¯áá² graph á¡áá±áá²á· ááŒááºááŒá®áž best path ááᯠáááºááᯠááœááºááá² ááá¯áá¬ááᯠá¡áá¯ááºáá®áá¬áááœá¬ážááá¯á· á ááºážá á¬ážááŒááºá·ááŒáá¡á±á¬ááºá Fig.1 ááá¯áááºááŒá®ážáá±á¬á· ááŸááºážááœá¬ážáá«áááºá áá¯á¶ááŸá¬ ááŒáá¬ážáááá¯áá«áá² graph ááŸá¬á node ááœá±ááŸááááºá á¡á²áá® node ááœá±ááᯠáááºáá±áá²á· path ááœá±áááºáž ááŸááá«ááááºá·áááºá node áá áºáá¯áá»ááºážá á®á character áá áºáá¯á¶ážáá»ááºážá á®ááᯠááá¯ááºá á¬ážááŒá¯ááŒá®ážáá±á¬á· path áá áºáá¯áá»ááºážá á®á input á á¬ááŒá±á¬ááºážááᯠáááºááᯠáá¯á¶á á¶áá»áá¯ážáá²á· segmentation áá¯ááºááœá¬ážáááºááá¯áá²á· áááºážááŒá±á¬ááºážááœá± ááŒá áºáá«áááºá Path áá áºáá¯á á®ááŸá¬ ááŒááºááœá¬ážáááºá·á á¬áá¯á¶ážáá²á·á¡áá° ááœá²áá±ážáá¬ážáá²á· ááááºážááœá±á path weight ááœá±ááŒá áºááŒá®ážá áááºááŸá á á¬áá¯á¶ážááŒááºááá¯á·áá¯ááºáá±áá²á· á á¬ááŒá±á¬ááºážáá²á· unigram negative log property ááœá± ááá¯á·áá°ááá±ážáá«á
áááá¯ááááºá¡áá±áá²á·á á¡áá¯ááºáá¯ááºáá²á·á¡áá«ááŸá¬ character áá±ážáá¯á¶ážááŒá áºáá²á· "á" "á" "á¬" áá²á· "á" ááᯠááœá²ááá¯á· ááá²á· sequence pattern á¡áá¯ááºáá¯á¶ážááᯠá ááºážá á¬ážááá¬ááá¯á· ááááºá á¡á±á¬ááºáá« path ááœá±ááᯠáááºá·ááœááºážá ááºážá á¬ážááá«áááºá
- Path1: 0--->1--->2--->3--->4 = 2.0 + 2.5 + 4.1 + 1.0 = 9.6 = á | á | ᬠ| á
- Path2: 0--->2--->3--->4 = 3.3 + 4.1 + 1.0 = 8.4 = áá | ᬠ| á
- Path3: 0--->3--->4 = 1.2 + 1.0 = 2.2 = ááᬠ| á
- Path4: 0--->4 = 2.8 = ááá¬á
- Path5: 0--->2--->4 = 3.3 + 3.8 = 7.1 = áá | á¬á
- Path6: 0--->1--->4 = 2.0 + 3.9 = 5.9 = á | áá¬á
- Path7: 0--->1--->3--->4 = 2.0 + 2.6 + 1.0 = 5.6 = á | áᬠ| á
á¡áááºááŸá¬ ááŒáá¬ážáá²á· path ááœá±áá²áá០Viterbi algorithm á best path ááá¯á·ááá¯áẠshortest path ááá¯ááœá±ážááŸá¬ ááŒá
áºáá«áááºá á¡á²áá«ááŒá±á¬ááºá· Path3: 0--->3--->4 = 1.2 + 1.0 = 2.2
á path ááœá±á¡á¬ážáá¯á¶ážáá²ááŸá¬ áááºááá¯ážá¡ááááºá·áá¯á¶ážááá¯á·ááá¯á· semented output á¡áá±áá²á·á "ááᬠ| á" ááá¯ááŒá®ážáá±á¬á· ááŸááºááŸááºáááºááẠword segmentation áá¯ááºáá±ážááŸá¬ ááŒá
áºáá«áááºá ááááºáááºážááœááºáá²á·á¡áá«ááŸá¬ á
á¬áá¯á¶áž áá
áºáá¯á¶ážáá»ááºážá
á®áá²á· probability á unigram á¡áááá¬ááºá áá¬áá¬ááŒá
áºááŒá®ážáá±á¬á· negative log probability ááᯠáá¯á¶ážáá¬ááŒá±á¬ááºá· á¡á±á¬ááºáá« áá¯á¶á
á¶áá»áá¯ážááœááºáᬠááŒá
áºáá«áááºá Shortest path ááᯠááœá±ážáá²á· á¡áá¯ááºááᯠBackward operation ááŸá¬ áá¯ááºááœá¬ážáᬠááŒá
áºáá«áááºá
-log(P( ááᬠ)) + -log(P( á )) = 1.2 + 1.0 = 2.2
á¡áááºá Fig.1 ááŸá¬ ááŒáá²á·áá²á· "ááá¬á" ááá¯áá²á· input á á¬ááŒá±á¬ááºážá¡ááœáẠá á¬áá¯á¶áž ááŒááºááá¯á·ááá²á· áááºážááŒá±á¬ááºážááœá± á¡áá»áá¯ážáá»áá¯ážááŸááá²á·á¡áá²ááá± shortest path ááᯠgraph á¡áá±áá²á· ááœá²ááŒááááºáá±á¬á· á¡á±á¬ááºáá«ááᯠáá¯á¶áá»áá¯áž (Fig. 2) ááᯠááœá²ááá¯á· ááá«ááááºá·áááºá
ááááºá· áááºááœá±á·ááŸá¬á ááá¬áá²á· á áá²á· ááŒááºáá¬á á¬áá¯á¶ážááœá±á corpus áá²ááŸá¬ á¡áá»á¬ážááŒá®ážááŸáááŸá¬ááá¯á· áá±áá¬áá»á¬ážáá»á¬ážáá²á· ngram á¡áááá¬ááºááᯠáá±á¬ááºáá¬ážááẠáá±á¬ááºáá¬ážáááᯠá á¬ááŒá±á¬ááºáž ááŸááºááẠááŸááºáááᯠword boundary ááᯠáááºá·ááŸááºážááá¯á·á¡ááœááºá ááœááºáá»á°áá¬á ááœááºááááºá· path ááœá±á áááºážáá²á·áá»á®ááŒá®áž ááŸáááœá¬ážááá¯ááºáá«áááºá á¡á²áá«ááŒá±á¬ááºá· HMM ááá¯áá±á¬áºáááºááœá±áá²á· decoding ááŸá¬ Viterbi algorithm ááᯠáá¯á¶ážááŒáá¬ááŒá áºáá«áááºá
ááŒááºáá¬á
á¬á¡ááœáẠWord Segmentation tool ááᯠimplementation áá¯ááºááá¯á· á
ááºážá
á¬ážáá²á·á¡áá«ááŸá¬áááºáž áá±áá¬áᬠááŸááááºááá¯ááẠááœááºááœááºáá°áá°áá²á· training áá¯ááºááŒá®áž ááá¯ážááŸááºážááŒá®áž powerful ááŒá
áºáá²á· algorithm áá²á· á
á¬áá¯á¶ážááœá±ááᯠááŒááºáá±ážááá¯á· á
ááºážá
á¬ážáá²á·á¡áá«ááŸá¬ Viterbi algorithm ááá¯áá² áá¯á¶ážááá¯á· áá¯á¶ážááŒááºáá²á·áá«áááºá ááŸá±á·á ááá¬ááœá±ááŒá
áºáá²á· Dr. Peter Norvig (á¡áá±ááááẠááœááºáá»á°áá¬áááá¹áá¶ááá¬ááŸááº, Google LLC áá²á· áá«ááá¯ááºáá¬) á áá±ážáá¬ážáá¬ážáá²á· Beautiful Data á
á¬á¡á¯ááºáá²á· Chapter 14: Natural Language Corpus Data áá²á· á¡áááºážááŸá¬áá¯á¶ážáá¬ážáá²á· ngram á¡áááá¬ááºáá±á¬ááºááŒá®ážáá±á¬á· Viterbi table áá±á¬ááºááŒá®áž á
á¬áá¯á¶ážááŒááºááŒáá¬ážáá¬ááᯠááŸá®ááŒááºážáá¬ážáá«áááºá Coding ááááºáž updated version code, Mark Dong ááᯠááŸá®ááŒááºážáá¬ážáá«áááºá ááá¯ááºá· corpus áá²á· ngram á¡áááá¬ááºááᯠáá±á¬ááºááá¯ááºá¡á±á¬áẠáá±ážáá²á·á¡ááá¯ááºážáá²á· plain text ááá¯áẠngram á¡áááá¬ááºááœá±á¡á
á¬áž binary á¡áááá¬ááºááœá±ááᯠáá¯á¶ážáá²á· á¡ááá¯ááºážááœá±ááᯠááŒááºá·á
áœáẠcoding áá¯ááºáá²á·áá«áááºá Recursion limit ááá¯áááºáž sys.setrecursionlimit(10**6)
ááá¯ááŒá®áž áááºá·áá²á·áá«áááºá myWord Segmentation tool ááŸá¬ áá±ážáá¬ážáá²á· viterbi function á á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á coding áááºááá¯ááºáá²á·áá°ááœá±á coding ááá¯áááºáááºáž Vitabi algorithm áá²á· word segmentation ááᯠáááºááᯠáá¯ááºááœá¬ážáááºááá¯áá¬ááᯠáá±á·áá¬áá¬á ááá¯ááŒááºáá»ááºáááºáž ááŒááºááá¯ááºáá«áááºá
@functools.lru_cache(maxsize=2**10)
#maxlen=20
def viterbi(text, prev='<S>', maxlen=20):
if not text:
return 0.0, []
print("text: ", text)
textlen = min(len(text), maxlen)
splits = [(text[:i + 1], text[i + 1:]) for i in range(textlen)]
candidates = []
for first_word, remain_word in splits:
#pdb.set_trace()
first_prob = math.log10(conditionalProb(first_word, prev))
print("first_prob of condProb(", first_word, ", ", prev, "): ", first_prob )
remain_prob, remain_word = viterbi(remain_word, first_word)
print("remain_prob: ", remain_prob, ", remain_word: ", remain_word)
candidates.append((first_prob + remain_prob, [first_word] + remain_word))
#print("first_prob: ", str(first_prob), ", remain_prob: ", remain_prob, ", [first_word]:", [first_word], ", remain_word: ", remain_word)
print("Candidates: ", candidates)
print("max(candidates): " + str(max(candidates)))
print("====================")
return max(candidates)
á¡áá¯ááºáá¯ááºáá¯á¶ááᯠtrace áá¯ááºááᬠááœááºá¡á±á¬ááºááá¯á· print statement ááœá±ááá¯áá« áááºááŒááºá·ááŒá®áž viterbi function ááᯠ"ááá¬á" ááá¯áá²á· á á¬ááŒá±á¬ááºážáá áºááŒá±á¬ááºážáááºážááá¯áá² áááºá·ááŒá®áž run áá±ážáá¬ážáá«áááºá ááœááºáá»á°áᬠterminal screen ááŸá¬ ááá¯ááºáá¯ááºáá±ážáá¬áá²á· á á¬ááŒá±á¬ááºážááœá±ááá±á¬á· á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á áá® function á recursive function á¡áá±áá²á· áá±á«áºáá¯á¶ážáá¬ážáá¬ááá¯áááºáž ááá¯ááŒá¯áá«á
$ python ./myword.py word ./one_line.txt ./one_line.word
text: ááá¬á
first_prob of condProb( á , <S> ): -2.3682169728893223
text: áá¬á
first_prob of condProb( á , á ): 0.15368326096895993
text: á¬á
first_prob of condProb( ᬠ, á ): -4.1075915061395
text: á
first_prob of condProb( á , ᬠ): 0.39394528587814026
remain_prob: 0.0 , remain_word: []
Candidates: [(0.39394528587814026, ['á'])]
max(candidates): (0.39394528587814026, ['á'])
====================
remain_prob: 0.39394528587814026 , remain_word: ['á']
Candidates: [(-3.71364622026136, ['á¬', 'á'])]
first_prob of condProb( á¬á , á ): -6.010681493131443
remain_prob: 0.0 , remain_word: []
Candidates: [(-3.71364622026136, ['á¬', 'á']), (-6.010681493131443, ['á¬á'])]
max(candidates): (-3.71364622026136, ['á¬', 'á'])
====================
remain_prob: -3.71364622026136 , remain_word: ['á¬', 'á']
Candidates: [(-3.5599629592924003, ['á', 'á¬', 'á'])]
first_prob of condProb( áᬠ, á ): -0.7926188753050689
text: á
first_prob of condProb( á , áᬠ): 0.39394528587814026
remain_prob: 0.0 , remain_word: []
Candidates: [(0.39394528587814026, ['á'])]
max(candidates): (0.39394528587814026, ['á'])
====================
remain_prob: 0.39394528587814026 , remain_word: ['á']
Candidates: [(-3.5599629592924003, ['á', 'á¬', 'á']), (-0.39867358942692865, ['áá¬', 'á'])]
first_prob of condProb( áá¬á , á ): -7.010681493131443
remain_prob: 0.0 , remain_word: []
Candidates: [(-3.5599629592924003, ['á', 'á¬', 'á']), (-0.39867358942692865, ['áá¬', 'á']), (-7.010681493131443, ['áá¬á'])]
max(candidates): (-0.39867358942692865, ['áá¬', 'á'])
====================
remain_prob: -0.39867358942692865 , remain_word: ['áá¬', 'á']
Candidates: [(-2.766890562316251, ['á', 'áá¬', 'á'])]
first_prob of condProb( áá , <S> ): -6.010681493131443
text: á¬á
first_prob of condProb( ᬠ, áá ): -4.1075915061395
remain_prob: 0.39394528587814026 , remain_word: ['á']
Candidates: [(-3.71364622026136, ['á¬', 'á'])]
first_prob of condProb( á¬á , áá ): -6.010681493131443
remain_prob: 0.0 , remain_word: []
Candidates: [(-3.71364622026136, ['á¬', 'á']), (-6.010681493131443, ['á¬á'])]
max(candidates): (-3.71364622026136, ['á¬', 'á'])
====================
remain_prob: -3.71364622026136 , remain_word: ['á¬', 'á']
Candidates: [(-2.766890562316251, ['á', 'áá¬', 'á']), (-9.724327713392803, ['áá', 'á¬', 'á'])]
first_prob of condProb( ááᬠ, <S> ): -1.2541214501247606
text: á
first_prob of condProb( á , ááᬠ): 0.39394528587814026
remain_prob: 0.0 , remain_word: []
Candidates: [(0.39394528587814026, ['á'])]
max(candidates): (0.39394528587814026, ['á'])
====================
remain_prob: 0.39394528587814026 , remain_word: ['á']
Candidates: [(-2.766890562316251, ['á', 'áá¬', 'á']), (-9.724327713392803, ['áá', 'á¬', 'á']), (-0.8601761642466204, ['ááá¬', 'á'])]
first_prob of condProb( ááá¬á , <S> ): -4.709651497467462
remain_prob: 0.0 , remain_word: []
Candidates: [(-2.766890562316251, ['á', 'áá¬', 'á']), (-9.724327713392803, ['áá', 'á¬', 'á']), (-0.8601761642466204, ['ááá¬', 'á']), (-4.709651497467462, ['ááá¬á'])]
max(candidates): (-0.8601761642466204, ['ááá¬', 'á'])
====================
ááá¯ááºá·ááŸá¬ manual word segmentation áá¯ááºáá¬ážááŒá®ážáá¬áž corpus á á¡áááºá·áááºá·ááŸááááºááá¯ááẠmyword áá²á· n-gram dictionary áá±á¬ááºááá¯á·á¡ááœááºá á¡á±á¬ááºáá«á¡ááá¯ááºáž command áá±ážáá«á
áá®áá±áá¬ááŸá¬ myword á unigram, bigram á¡áááá¬ááºááœá±ááᯠtext file format á¡áá±áá²á·áá±á¬ binary file format á¡áá±áá²á·áá±á¬ áá±á¬ááºáá±ážááœá¬ážááŸá¬ááá¯á· á¡á²áá® output filename ááœá±ááᯠ--unigram_word_txt unigram-word.txt
, --bigram_word_txt bigram-word.txt
, --unigram_word_bin unigram-word.bin
, --bigram_word_bin bigram-word.bin
ááá¯ááŒá®áž ááá¯ááºáá±ážáá»ááºáá²á· ááá¯ááºáá¬áááºááœá±ááᯠassign áá¯ááºááœá¬ážááá¯á· ááá«áááºá
Word n-gram dictionary building with full dictionary filenames parameters:
$ python ./myword.py build_dict --unigram_word_txt unigram-word.txt --bigram_word_txt bigram-word.txt --unigram_word_bin unigram-word.bin --bigram_word_bin bigram-word.bin ./corpus2.1k
ááááºááá¯á· default ngram dictionary áá¬áááºááœá±áá²á·áá² áá±á¬ááºááœá¬ážáááºá ááá¯ááºáá¬áááºááœá±ááᯠáá®ážáááºá· assign áá¯ááºáá¬áá»áá¯áž ááá¯ááºáá°áž ááá¯áááºáá±á¬á· á¡á±á¬ááºáá«á¡ááá¯ááºáž command á¡ááá¯áá²á·áá² ngram á¡áááá¬ááºááœá±ááᯠáá±á¬ááºááœá¬ážááá¯á· ááá«áááºá
Word n-gram dictionary building with default filenames:
$ python ./myword.py build_dict ./corpus2.1k
myword áá²á· word segmentation áá¯ááºáá¬ááᯠdefault n-gram dictionary ááœá±ááá¯áá² áá¯á¶ážááŒá®áž á
á¬áá¯á¶ážááŒááºáááºááá¯áááºáá±á¬á· á¡á±á¬ááºáá«á¡ááá¯ááºáž command áá±ážááá«áááºá
áá®áá±áá¬ááŸá¬ ./test.txt ááá¯ááºá input file ááŒá
áºááŒá®ážáá±á¬á· ./test.word ááá±á¬á· á
á¬áá¯á¶ážááŒááºááŒá®áž ááœááºáá¬áá²á· ááá¯ááºááá¯ááááºážá
á±áá»ááºáá²á· áá¬áááºáá«á
Word segmentation with default n-gram dictionaries:
$ python ./myword.py word ./test.txt ./test.word
input ááá¯ááºá á¡á±á¬ááºáá«á¡ááá¯ááºáž áá¯á¶ážáá¬ážáá«áááºá
(space ááœá±áá«áá±áááºáž myword á auto remove áá¯ááºáá±ážááœá¬ážááŸá¬ááá¯á· ááá°ážáá space ááœá±ááᯠááŒá¯ááºááŒá®ážá០input áá¯ááºá
áá¬áááá¯áá«áá°ážá áá¯á á¥ááá¬á¡áá±áá²á· ááŒááºáá¬á¡á±á¬ááºáᬠááŒáá¬ážáá¬áá«)
$ cat test.txt
áá»áœááºáá±á¬áºááá¯áá±ááááá¬ážáá«á
áá±á·áá±á¬ááá±á¬ááŒááºáá¬á
á¬áá²á·ááœááºáá»á°áá¬áá²á·áá²á¡áá¯áẠáá»á¬áž áá« áááº
áááºážááá±á¬áá¬á¡áá¯ááºáá¯ááºáá¬áá²á
ááŒá±á¬ááŒáá«á¡á¯á¶áž
áá±á¬áá®áááºážáááºáá±á¬ááºáá»ááºáááºááŒá±á¬ááœá¬
ááá¹ááá±ážááŸá¬áá±á«áºá¡á±á¬ááºáááºážá
á¯ááŒááºááááºá·ááœááºážááŒá±á¬áááºáá²á·á
word segmented áá¯ááºááŒá®áž ááœááºáá¬áá²á· output ááá¯ááºá á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
$ cat test.word
áá»áœááºáá±á¬áº á áá¯áá±áá ááá¬áž áá« á
áá±á· áá±á¬ á áá±á¬ ááŒááºáᬠá
ᬠáá²á· ááœááºáá»á°áᬠáá²á· áá² á¡áá¯áẠáá»á¬áž áá« áááº
áááºáž á áá±á¬ áᬠá¡áá¯áẠáá¯áẠáᬠáá² á
ááŒá±á¬ áጠáá« á¡á¯á¶áž
áá±á¬áá® áááºáž ááẠáá±á¬áẠáá»áẠááẠááŒá±á¬ ááœá¬
ááá¹ááá±áž ááŸá¬ áá±á«áºá¡á±á¬ááºáááºážá
á¯ááŒáẠááááºá·ááœááºáž ááŒá±á¬ ááẠáá²á· á
word segmentation áá¯ááºáá²á· á¡áá«ááŸá¬ unigram, bigram á¡áááá¬ááºááœá±ááᯠassign áá¯ááºááŒá®áž ááŒááºáááºááá¯áááºáá±á¬á· á¡á±á¬ááºáá«á¡ááá¯ááºáž command áá±ážááŒá®áž run áá«á
(Word segmentation with unigram, binary n-gram dictionaries)
$ python ./myword.py word --unigram_word_bin ./unigram-word.bin --bigram_word_bin ./bigram-word.bin ./test.txt ./test.word
Word Segmentation ááŒááºáá²á·á¡áá«ááŸá¬ default á space áá²á·ááŒá¬ážáá±ážááŸá¬ ááŒá áºáá±áá²á· delimiter ááá¯áááºáž á¡áá»áá¯ážáá»áá¯áž ááŒá±á¬ááºážááá¯á· ááá«áááºá á¥ááᬠdelimiter ááᯠpipe á¡ááŒá áºáá¬ážááŒá®áž word segmentation áá¯ááºáá»ááºááẠááá¯áááºáá±á¬á· á¡á±á¬ááºáá«á¡ááá¯ááºáž command áá±áž run áá«á
(Word segmentation with delimiter "pipe")
$ python ./myword.py word --delimiter "|" ./test.txt ./test.word
ááœááºáá¬áá²á· segmented output ááá¯ááºá á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
áá»áœááºáá±á¬áº|á|áá¯áá±áá|ááá¬áž|áá«|á
áá±á·|áá±á¬|á|áá±á¬|ááŒááºáá¬|á
á¬|áá²á·|ááœááºáá»á°áá¬|áá²á·|áá²|á¡áá¯ááº|áá»á¬áž|áá«|áááº
áááºáž|á|áá±á¬|áá¬|á¡áá¯ááº|áá¯ááº|áá¬|áá²|á
ááŒá±á¬|ááŒ|áá«|á¡á¯á¶áž
áá±á¬áá®|áááºáž|áááº|áá±á¬ááº|áá»ááº|áááº|ááŒá±á¬|ááœá¬
ááá¹ááá±áž|ááŸá¬|áá±á«áºá¡á±á¬ááºáááºážá
á¯ááŒááº|ááááºá·ááœááºáž|ááŒá±á¬|áááº|áá²á·|á
Phrase Segmentation áá¯ááºáá¬á Normalized pointwise mutual information (NPMI) áá²á·áá«á
Assoc. Prof. Daichi Mochihashi áá²á· áá»áááºááá¯áá±ážáá¬ážáá²á· blog ááᯠááœá±á·ááŒá®áž ááŒááºáá¬á
á¬á¡ááœáẠá
ááºážááŒááºá·ááá¯á· á¡áá¯ááºáá®áᬠááá²á·áá«áááºá áá° ááŸááºážááŒáá¬ážáá¬ááá¯áá² á¡ááŒá±áá¶ááŒá®áž ááá¬á
á¬á¡ááœáẠá
ááºážáá²á·áá²á· á¡ááá¯ááºážááᯠááŸááºážááŒááœá¬ážáá«áááºá
Wrod2Vec áá²á· áááºáááºáá²á· áá¬áááºááŒá®áž á á¬áááºážááŸá áºá á±á¬áẠááᯠá¡áááºáá¯á¶áž refer áá¯ááºááŒá០á¡áá±ážá ááẠáá¬ááºáááºáááºáá«ááááºá·áááºá
áááá á¬áááºáž ááŒá áºáá²á· Efficient Estimation of Word Representations in Vector Space, (Mikolov et al., 2013) á á¬áááºážáá²ááŸá¬ á¡á±á¬ááºáá«á¡ááá¯ááºáž áá±á¬áºááŒáá¬ážáá¬ááᯠááœá±á·ááá«ááááºá·áááºá
We have included in our test set only single token words, thus multi-word entities are not present (such as New York).
áááá á¬áááºážáá²á· test set ááŸá¬ single token word ááœá±áá² áá¯á¶ážáá¬ážááŒá±á¬ááºáž áá±á¬áºááŒáá¬ážáá«áááºá ááá¯ááá¯áá¬á "New York", "ice cream", "high school", "hot dog", "living room", "full moon", "up to date", "part-time work", "state of the art" ááá¯á·ááᯠá á¬áá¯á¶áž ááŸá áºáá¯á¶ážáá²á· á¡áááºááœá²áá±áá²á· á áá¬ážáá¯á¶ážááœá± (word) ááœá±ááᯠword2vec á¡áá±áá²á· train áá¯ááºáááºááá¯ááẠá¡áááºáá¯á¶áž á¡ááŒá²áááºáž ááœá²ááŒá®ážáá¯á¶ážáá±áá²á· á á¬áá¯á¶ážááœá²ááœá± ááááºážá¡á¬ážááŒááºá· phrase ááœá±ááᯠáá«ááá¯á·á ááŒáá¯ááááá¯á· ááá¯á¡ááºáá«áááºá á¡á²áá®ááᯠááááŒá®ážááŸáᬠword2vec ááᯠtrain ááá¯ááºáááºááŸá¬ preprocessing á¡áá±áá²á· á¥ááᬠ"new_york", "ice_cream", ..., "up_to_date", "part_time_work", "state_of_the_art" á¡ááŒá Ạunderscore áá²á· ááœá²áá¬áá»áá¯áž áá¯ááºááŒá®áž á á¬áá¯á¶ážáá áºáá¯á¶ážá¡áá±áá²á· training corpus áá²ááŸá¬ ááŒáá¯ááŒááºáá¬ážááá¯á· ááá¯á¡ááºáá«ááááºá·áááºá á¡á²áá® ááá¯áá»áá¯áž NLP task á¡ááœááºá supervised approach áá²á· ááá¯ááẠNER (Name Entity Recognition) model áá²á· áá¯ááºááá¯á· ááá±áá²á· NER model áá±á¬ááºááá¯á·á¡ááœááºá NER corpus á ááŸááá±á០ááŒá áºáá«ááááºá·áááºá á¡á²áá«ááŒá±á¬ááºá· NER corpus ááᯠááá¯á¶ážáá²áá²á· unsupervised approach á¡áá±áá²á· ááœá¬ážáááºááá¯ááẠáááºááᯠáá¯ááºááá¯á· áááá¯ááºááẠááá¯áá¬ááᯠWord2Vec áá²á·áá¯áááá á¬áááºážááá¯á· ááŒá±á¬ááá¯á·ááá²á· Distributed Representations of Words and Phrases and their Compositionality, (Mikolov et al., 2013) á á¬áááºážáá²á· Section 4. Learning Phrases ááŸá¬ Formula No. 6 á¡áá±áá²á· á¡á±á¬ááºáá«á¡ááá¯ááºáž áá±á¬áºááŒáá¬ážáá¬ááᯠááœá±á·ááá«ááááºá·áááºá
áá®áá±áá¬ááŸá¬ ááŒá±á¬áá±áá²á· n (v, w), n (v), n (w) ááœá±á bigram áá²á· unigram frequency ááœá± ááŒá áºááŒá®ážáá±á¬á· ÎŽ á frequency ááááºá·áá²á· á áá¬ážáá¯á¶ážááœá²ááœá±á ááááºááá¯ááºážááᯠáá±á¬ááºááá¬ááá¯á·á¡ááœáẠááááºážááŸááá²á· discount factor áá«á Phrase ááœá±ááᯠááœá²áá¯ááºááá¯ááºááá¯á·á¡ááœááºá threshold áá áºáᯠáááºááŸááºáá¬ážááŒá®áž á¡á²áá® threshold value á¡áááºááŸá¬ ááŸááá²á· bigram á áá¬ážáá¯á¶ážááœá²ááœá±ááᯠááœá±ážáá°ááá¯ááºáá¯á¶áá«áá²á Threshold value á¡ááẠááá¯áá¬ááᯠprobability á¡áá±áá²á· á ááºážá á¬ážááŒááºá·ááẠp (v, w) = n (v, w) / N, p (v) = n (v) / N, p (w) = n ááá¯ááŒá®áž áá±á¬áºááŒá°áá¬á¡áá±áá²á· áá±ážááá¯á· ááá«áááºá áá®áá±áá¬ááŸá¬ "N" ááá¯áá¬á unigram á á¯á á¯áá±á«ááºážáááºááá¯ážáá«á ÎŽ ááᯠáááºááŒá®ážáá±á¬á· score ááœááºááá¯á·á¡ááœáẠá ááºážá á¬ážááẠá¡á±á¬ááºáá«á¡ááá¯ááºáž áá±ážááá¯á· ááá«áááº
score (v, w) = n (v, w) / (n (v) * n (w)) = (p (v, w) * N) / (p (v) * N * p (w) * N) = p (v, w) / (p (v) * p (w) * N)
áá«ááŒá±á¬ááºá· áá® score ááœááºáá²á· á¡ááá¯ááºážá self-mutual information PMI ááœááºáá²á· PMI (v, w) = log p (v, w) / (p (v) * p (w)) ááá¯áá²á· áá±á¬áºááŒá°áá¬áá²á· á¡áá¯ááºáá¯á¶ážááá¯ááᯠáááºáá°ááŒá áºáá¬ááᯠááœá±á·ááá«ááááºá·áááºá áá«áá±áá²á· áá±áá±áá»á¬áá»á¬ ááŒáẠááŸáá¯ááºážááŸááºááŒááºá·áá²á· á¡áá«ááŸá¬á á¡á±á¬áºááá»ááºááẠáá±á¬áºááŒá°áá¬ááŸá¬á 1/N ááá¯áá²á· factor á áá«áááºááŒá®ážáá±á¬á· á¡á²áá«á corpus á¡áá±á«áºááŸá¬ áá°áááºáá±ááá¯á· ááœááºáá¬áááºá· score á á¡ááŒá±áá¶á¡á¬ážááŒááºá· corpus áá²á· length áá±á«áºááŸá¬ ááœá¬ážááŒá®áž áá°áááºáá±áá«áááºá corpus ááᯠá¡ááŒá±á¬ááºážá¡áá² áááºááá¯ážáá¬áá»áá¯áž ááá¯ááºáá² fixed áá¯ááºáá¬ážááŒá®ážáá±á¬á· threshold áááºááá¯ážááᯠsearch áá¯ááºáá¬áá»áá¯ážáá¯ááºáááºáá±á¬á· á¡ááá¯ááºážá¡áᬠáá áºáá¯á¡áá ááŒá±áááºáá±áá²á· threshold áá²á· á¡áááá¹áá«ááºá áá¬ážáááºááááºáá²á·á¡ááŒáẠlength ááá°áá²á· á á¬ááŒá±á¬ááºážááœá±ááᯠáá¯á¶ážááŒá®ážáá±á¬á· score ááœá±ááᯠááŸáá¯ááºážááŸááºááŒááºá·ááŒá®ážááœá¬ážáááºááá¯ááẠááá¬áá²á· phrase ááœá±á áá¯á¶ááŸáẠáá°ááœá±á áá¯á¶ážáá±ááŒáá²á· phrase áá²á·áá±á¬á· ááááºáááºáž áá»ááŸá¬ ááá¯ááºáá«áá°ážá
corpus ááᯠindependent ááŒá áºááá¯á·á¡ááœááºá original score áááºááá¯ážááᯠN áá²á· ááŒáŸá±á¬ááºááá¯á· ááá«áááºá ááá¯á·áá±á¬áº á¡áá¯ááŒá±á¬áá±áá²á· score ááá¯áá¬á PMI ááᯠááœááºáᬠááŒá áºáá¬ááŒá±á¬ááºá·
- PMI áá²á·á á¡á¬ážáááºážáá»ááºá low frequency word ááœá±ááᯠá¡á¬ážáááºážáá¬
- PMI scale ááááºáž áá±áá¬áá±á«áºáá°áááºááŒá®ážáá±áá¬
á
áá²á· á¡áá»ááºááœá±áááºáž ááŸááá¬ááŒá±á¬ááºá· Normalized PMI (NPMI) (Bouma 2009) ááᯠáá¯á¶ážáááºá·áááºááá¯á· áááºáá«áááºá
NPMI ááá¯áá¬á á¡á±á¬ááºáá«á¡ááá¯ááºáž áááºááŸááºáá¬ážáá«áááºá
NPMI (v, w) = log p (v, w) / (p (v) * p (w)) / (-log p (v, w))
NPMI ááᯠ-1âŠNPMI(v,w)âŠ1 ááá¯áá²á· range á¡ááœááºážááŸá¬ áááºááŸááºáá¬ážáá¬ááŒá±á¬ááºá· 1 ááŒá áºáá±áá²á· á¡áá»áááºááŸá¬ v áá²á· w ááá¯á·áᬠááá¯ááºááá¯áẠcorrelation ááŒá áºáá±ááŒá®áž -1 ááŒá áºáá±áá²á· á¡áá»áááºááŸá¬áá±á¬á· inverse correlation ááŒá áºáá±ááŒá±á¬ááºážááᯠáá¬ážáááºá ááœááºáá°áá«áááºá ááŒá®ážáá±á¬á· PMI ááŸá¬áá¯ááºážá ááŸááá²á·áá²á· "p(v)" ááá¯á· "p(w)" ááá¯á·áá²á· áááºááá¯ážááœá±á á¡áááºáž áá±ážáááºáá²á· á¡áá«ááŸá¬ score ááᯠáá±á¬ááºážááœá á±ááá¯ááºáá²á· á¡á¬ážáááºážáá»ááºááá¯áááºáž ááŸá±á¬ááºááŒá®ážááœá¬áž ááŒá áºááœá¬ážáá«ááááºá·áááºá á¡á²áá®ááá¯áá¬ááá¯ááẠWord2vec áá²á· á¡á±á¬áºááá»ááºáááºá á¬áááºážááŸá¬ áá¯á¶ážáá²á·áá²á· heuristic discount coefficient áááºááá¯áž ááŒá áºáá²á· ÎŽ áááºáž áááá¯á¡ááºáá±á¬á·áá«áá°ážá
á¡á²áá«ááŒá±á¬ááºá· script áá áºáá¯áẠáá±ážááŒá®ážáá±á¬á· phrase á¡á±á¬áºááá¯ááŒááºáá¬ááᯠá ááºáž ááŒááºá·ááŒá áºáá²á·áá«áááºá Phrase recognition ááá¯á·ááá¯áẠphrase segmentation áá¯ááºáá²á· core á¡ááá¯ááºážááá¯áá² áá±ážááá¯á·á¡ááœáẠunigram, bigram frequency ááœá±ááᯠdictionary ááŸá áºáá¯á¡áá±áá²á· ááááºážáá¬ážáá²á·ááŒá®ážá word bigram (v, w) á phrase ááŒá áºáááŒá áºááᯠáá¯á¶ážááŒááºáá²á· á¡ááá¯ááºážááá¯áá² Python script áá²á· áá±ážááŒáááẠá¡á±á¬ááºáá«á¡ááá¯ááºáž ááŒá áºáá«ááááºá·áááºá
def compute_phrase (unigram, bigram, threshold = 0.5):
N = sum (list (unigram.values ââ()))
phrases = {}
for bi, freq in bigram.items ():
if freq> 1:
v = bi [0]; w = bi [1]
npmi = (log (N) + log (freq) --log (unigram [v]) --log (unigram [w])) \
/ (log (N) --log (freq))
if npmi> threshold:
phrases [bi] = npmi
return phrases
Threshold áááºááá¯ážá áá»áááºá
á¬á¡ááœááºá 0.5 áá¬ážááŒá®áž á
ááºážáá²á·áá±áá²á· ááŒááºáá¬á
á¬á¡ááœááºá (0.1...0.5) áá¬ážááŒá®áž á¡áá»áá¯ážáá»áá¯áž á
ááºážááŒááºá·áá²á·áá«áááºá
á¡áááºáá« algorithm ááᯠword segmentation áá¯ááºáá¬ážáá²á· ááŒááºáá¬á
ᬠcorpus áá
áºáá¯áá¯á¶ážááᯠpass áá¯ááºááŒá®ážááœá¬ážáá²á· á¡áá«ááŸá¬ á
á¬áá¯á¶ážááŸá
áºáá¯á¶ážááœá² á
áá¬ážá
ᯠ(two-word phrase) ááœá±ááᯠáááŸááá¬ááŸá¬ ááŒá
áºáá«áááºá ááááºááá¯á· áá¯áááá¡ááŒááẠpass áá¯ááºááŒá®ážááœá¬ážáááºáá±á¬á· á
á¬áá¯á¶áž ááŸá
áºáá¯á¶áž ááá± áá±ážáá¯á¶ážá¡áá ááœá²áá»ááºááŸááá±áááºáá²á· á
áá¬ážá
ᯠ(two- to four-word phrase) ááœá±ááᯠáááŸááá¬ááŸá¬ ááŒá
áºáá«áááºá á¡á²áá«ááŒá±á¬ááºá· áá®á¡áá¯áá®á¡áááá±á¬á· passing ááᯠn pass á¡áá áá¯ááºááẠááá¯ááẠ2 ááá± 2^n á
á¬áá¯á¶ážááœá² phrase ááœá±ááᯠáááŸáááá¯ááºááŸá¬ ááŒá
áºáá«áááºá
áááºáá²á·á á¬áá¯á¶áž ááŒááºáá¬ážáá²á· (i.e. manual word segmentation) áá¯ááºáá¬ážáá²á· á á¬ááŒá±á¬ááºážáá± á ááááºážáá»á±á¬áº ááŸááá²á· ááŒááºáá¬á ᬠcorpus ááᯠáá¯á¶ážááŒá®áž phrase segmentation experiment ááá»áá¯á· áá¯ááºááŒááºá·ááŒáá¡á±á¬ááºá
Threshold value=0.1, frequency=3, 1 time pass á¡áá±áá²á· run ááŒááºá·áá¬ážáá«áááºá
$ time python ./myword.py train_phrase -l 1 -t 0.1 -f 3 --unigram_phrase_txt unigram.l1.t0.1f3.txt --bigram_phrase_txt bigram.l1.t0.1f3.txt --unigram_phrase_bin unigram.l1.t0.1f3.bin --bigram_phrase_bin bigram.l1.t0.1f3.bin ./corpus2 ./train.l1t0.1f3.out
{'command': 'train_phrase', 'iteration': 1, 'threshold': 0.1, 'minfreq': 3, 'unigram_phrase_txt': 'unigram.l1.t0.1f3.txt', 'bigram_phrase_txt': 'bigram.l1.t0.1f3.txt', 'unigram_phrase_bin': 'unigram.l1.t0.1f3.bin', 'bigram_phrase_bin': 'bigram.l1.t0.1f3.bin', 'input': './corpus2', 'output': './train.l1t0.1f3.out'}
computing phrases: threshold = 0.1 minfreq = 3
pass [1/1]..
- computing phrases..
- writing output..
done.
real 1m4.555s
user 1m3.892s
sys 0m0.484s
pass á áá áºáá«áá² áá¯ááºáá¬ááá¯á· corpus áá²ááŸá¬ áá«áááºáá²á· bigram á á¬áá¯á¶ážááœá²ááœá±áá²á· frequency áá±á«áºáá°áááºááŒá®áž threshold value áá±á«áºááᯠáá°áááºááŒá®áž ááœá²áá¯ááºááá¯á· ááá¬áá²á· ááŒááºáá¬á ᬠphrase á¥ááᬠááá»áá¯á·á á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
$ tail ./train.l1t0.1f3.out
áá°_áᬠáááºááŸá±á·ááœá² ááŸá¬ á¡ááá¯ááº_á ááá¯áẠá
áá¬_ááŸá áááº
áá°_áᬠáááºááŸá±á· ááá¯ážáááºááœá² ááŸá¬_ááŸá¯á¶ážááááºá· ááá¯á·_á ááŒá
áº_ááá¯áẠáá±á¬áẠáá°áž
áá°áááº_ááá±áž áᬠáá«áž_áá»áŸá¬áž áá±_áááº
áá° áá¶áá±á¬ááºáž ááẠáá«áž áá
áº_áá±á¬áẠáá ááá¯áẠáááº
áá
áºááá¯ááºáž áᬠááááº_á ááá¯áẠáá°áž
áááºáž áá¬â áá»áá¯áž áá»áẠáá»áá¯áž_ááœá¬áž ááá¯áẠáááº
áá
áºááá¯ááºáž_áá»áá¯áž áá»_ááœá¬áž áááº_áá±á¬ááºááá±áž áᬠááŒá
áº_áá² ááᯠáá»_ááœá¬áž ááá¯á· á¡áá¬ážá¡áá¬_ááŸá áááº
áá° ááŒá
áº_áá² ááᯠáá»_ááœá¬áž ááẠáá° áá±á
áᯠááá¯á· ááŒá
Ạáá±á¬ááºáž ááŒá
áº_ááá¯áẠááááºá·_áááº
áá¯ááºáá¯á¶ áá²_ááŸá¬ áá»á¬áž áá
áº_áá±á¬áẠááŸá_áááº
áááºáž áá¬_áá¯áẠááá¯áẠáááº_ááá¯á· áááºáá»á¬áž áááº_ááá²
Threshold value=0.1, frequency=3, 2 time pass áá¬ážááŒá®áž run áá¬ážáá«áááºá
$ time python ./myword.py train_phrase -l 2 -t 0.1 -f 3 --unigram_phrase_txt unigram.l2.t0.1f3.txt --bigram_phrase_txt bigram.l2.t0.1f3.txt --unigram_phrase_bin unigram.l2.t0.1f3.bin --bigram_phrase_bin bigram.l2.t0.1f3.bin ./corpus2 ./train.l2t0.1f3.out
{'command': 'train_phrase', 'iteration': 2, 'threshold': 0.1, 'minfreq': 3, 'unigram_phrase_txt': 'unigram.l2.t0.1f3.txt', 'bigram_phrase_txt': 'bigram.l2.t0.1f3.txt', 'unigram_phrase_bin': 'unigram.l2.t0.1f3.bin', 'bigram_phrase_bin': 'bigram.l2.t0.1f3.bin', 'input': './corpus2', 'output': './train.l2t0.1f3.out'}
computing phrases: threshold = 0.1 minfreq = 3
pass [1/2]..
- computing phrases..
- writing output..
pass [2/2]..
- computing phrases..
- writing output..
done.
real 1m38.575s
user 1m37.342s
sys 0m1.125s
áá®áá áºáá«áá±á¬á· passing ááᯠááŸá áºáá« áá¯ááºáá¬ážáá¬ááá¯á· á á¬áá¯á¶áž ááŸá áºáá¯á¶ážááœá² phrase ááœá±áá¬áááá² áá¯á¶ážáá¯á¶ážááœá²á áá±ážáá¯á¶ážááœá² phrase ááœá±áááºáž ááœá²áá¯ááºáá¬ááá¯ááºáá¬ááᯠááœá±á·ááá«ááááºá·áááºá
$ tail ./train.l2t0.1f3.out
áá°_áᬠáááºááŸá±á·ááœá² ááŸá¬ á¡ááá¯ááº_á ááá¯áẠá
áá¬_ááŸá_áááº
áá°_áᬠáááºááŸá±á· ááá¯ážáááºááœá² ááŸá¬_ááŸá¯á¶ážááááºá· ááá¯á·_á_ááŒá
áº_ááá¯áẠáá±á¬ááº_áá°áž
áá°áááº_ááá±áž áᬠáá«áž_áá»áŸá¬áž áá±_áááº
áá° áá¶áá±á¬ááºáž_ááẠáá«áž_áá
áº_áá±á¬áẠáá ááá¯ááº_áááº
áá
áºááá¯ááºáž áᬠááááº_á ááá¯áẠáá°áž
áááºáž áá¬â áá»áá¯áž áá»áẠáá»áá¯áž_ááœá¬áž ááá¯ááº_áááº
áá
áºááá¯ááºáž_áá»áá¯áž áá»_ááœá¬áž áááº_áá±á¬ááºááá±áž áᬠááŒá
áº_áá²_ááᯠáá»_ááœá¬áž ááá¯á·_á¡áá¬ážá¡áá¬_ááŸá áááº
áá° ááŒá
áº_áá²_ááᯠáá»_ááœá¬áž ááẠáá° áá±á
áᯠááá¯á· ááŒá
Ạáá±á¬ááºáž_ááŒá
áº_ááá¯áẠááááºá·_áááº
áá¯ááºáá¯á¶_áá²_ááŸá¬ áá»á¬áž_áá
áº_áá±á¬áẠááŸá_áááº
áááºáž áá¬_áá¯áẠááá¯ááº_áááº_ááá¯á· áááºáá»á¬áž áááº_ááá²
Threshold value=0.1, frequency=1, 2 time pass áá¬ážááŒá®áž run áá¬ážáá«áááºá
$ time python ./myword.py train_phrase -l 2 -t 0.1 -f 1 --unigram_phrase_txt unigram.l2.t0.1f1.txt --bigram_phrase_txt bigram.l2.t0.1f1.txt --unigram_phrase_bin unigram.l2.t0.1f1.bin --bigram_phrase_bin bigram.l2.t0.1f1.bin ./corpus2 ./train.l2t0.1f1.out
{'command': 'train_phrase', 'iteration': 2, 'threshold': 0.1, 'minfreq': 1, 'unigram_phrase_txt': 'unigram.l2.t0.1f1.txt', 'bigram_phrase_txt': 'bigram.l2.t0.1f1.txt', 'unigram_phrase_bin': 'unigram.l2.t0.1f1.bin', 'bigram_phrase_bin': 'bigram.l2.t0.1f1.bin', 'input': './corpus2', 'output': './train.l2t0.1f1.out'}
computing phrases: threshold = 0.1 minfreq = 1
pass [1/2]..
- computing phrases..
- writing output..
pass [2/2]..
- computing phrases..
- writing output..
done.
real 1m57.006s
user 1m55.366s
sys 0m1.373s
áá® áá áºáá«áá±á¬á· frequency ááᯠáá áºááŒáááºáá«áá¬áá²á· phrase á¡ááŒá Ạáááºá·ááœááºážá ááºážá á¬ážáá²á·á¡á¯ááºá á¯á¡áá²ááᯠáááºáá¬ááŸá¬ááá¯á· ááœá²áá¯ááºááŒá®áž ááá¬áá²á· phrase ááœá²ááœá±ááŸá¬ á¡ááŒá±á¬ááºážá¡áá² ááŒá áºáá¬áá¬ááá¯áááºáž ááŒááºááœá±á·áááŸá¬ ááŒá áºáá«áááºá á¥ááᬠ"áááºáá»á¬áž_áááº_ááá²" ááᯠphrase áá áºáá¯á¡áá±áá²á· ááœá²áá±ážááœá¬ážáá¬áá»áá¯ážáá«á
$ tail ./train.l2t0.1f1.out
áá°_áá¬_áááºááŸá±á·ááœá² ááŸá¬ á¡ááá¯ááº_á ááá¯áẠá
áá¬_ááŸá_áááº
áá°_áᬠáááºááŸá±á·_ááá¯ážáááºááœá²_ááŸá¬_ááŸá¯á¶ážááááºá· ááá¯á·_á_ááŒá
áº_ááá¯áẠáá±á¬ááº_áá°áž
áá°áááº_ááá±áž_áᬠáá«áž_áá»áŸá¬áž_áá±_áááº
áá°_áá¶áá±á¬ááºáž ááẠáá«áž_áá
áº_áá±á¬áẠáá ááá¯ááº_áááº
áá
áºááá¯ááºáž_áᬠááááº_á_ááá¯áẠáá°áž
áááºáž_áá¬â_áá»áá¯áž áá»ááº_áá»áá¯áž_ááœá¬áž ááá¯ááº_áááº
áá
áºááá¯ááºáž_áá»áá¯áž áá»_ááœá¬áž_áááº_áá±á¬ááºááá±áž áá¬_ááŒá
áº_áá² ááᯠáá»_ááœá¬áž ááá¯á·_á¡áá¬ážá¡áá¬_ááŸá áááº
áá°_ááŒá
áº_áá² ááᯠáá»_ááœá¬áž ááẠáá° áá±á
áá¯_ááá¯á· ááŒá
Ạáá±á¬ááºáž_ááŒá
áº_ááá¯áẠááááºá·_áááº
áá¯ááºáá¯á¶_áá²_ááŸá¬ áá»á¬áž_áá
áº_áá±á¬áẠááŸá_áááº
áááºáž áá¬_áá¯áẠááá¯ááº_áááº_ááá¯á· áááºáá»á¬áž_áááº_ááá²
Threshold value=0.1, frequency=3, 2 time pass ááá¯áá²á· training áá²á·áá² corpus áá²ááá± ááŸááºáá²á· á á¬ááŒá±á¬ááºážááœá±ááᯠááá± ááá¬áá²á· phrase ááœá±ááá¯áááºáž áá±á·áá¬ááŒááºá·ááẠá¡á±á¬ááºáá«ááá¯áá»áá¯áž á áááºáááºá á¬ážá áá¬áá±á¬ááºážáá²á· ááŒááºáá¬á ᬠphrase á¡ááœá²ááœá± áááá¯ááºáá¬ááᯠááŒááºááœá±á·ááá«ááááºá·áááºá
$ shuf ./train.l2t0.1f3.out | head
áá«_ááŒá±á¬áá·áº_á_áá»áœááºáá±á¬áº áᬠá©áá¬_ááœáŸááºážááá¯áž áá±áž_áááºážááŒá±á¬ááºáž_ááᯠáá² ááá¯áẠáá²á·_áááº_á
áá®ážááŒá¬áž á¡áá±á¬áá·áº_áá
áº_áᯠááŸááºá·_áá°ážááœá² á
á¬áááºáž á¡áá±á¬ááºá·_ááœááºá· áá¬áž_ááŒááºáž_ááẠááœá±ááŒá±áž ááŒá¿áá¬_á¡áááºážááẠááá¯_áá»á±á¬áºááœáŸá¬áž áááº_á¡ááŸááºáááẠá¡áá±á¬ááºá¡áá°_ááŒá¯_ááá¯áẠáá«_áááº_á
áááº_ááẠááá¯_áááº_áá±á¬ ð_ð_ð
ááááºážááá±áž á¡ááœáẠáá¬áž_áá«ááŸááá¯áẠáá±á¬ááºá»á¬ážáá±áž_á¡ááœáẠáá¬áž
áááºážáá¬_ááá¯ááº_áᬠááá¯áááº_ááá¯á· áááº_á ááœááºáž_ááœááºáž á¡ááŒááº_ááŸá¬ á¡ááŒá¬áž_áá
á¹á
ááºáž áá±áž_áá«áž áááºáž_ááá¯á¡áẠááá»áŸ_áááá·áº ááŒ_áá« á_áááá·áºáá±á¬áºá ááᯠáá¯ááá¯áẠáá±áž_ááŒ_áá«
áá»á¬áž ááá¯_áá²á·_ááá¹ááá« áá±áž_ááœá±_áᬠáá°á·_áá¬áá¬_ááᯠáá¬_ááŸ_á_áá¯áẠáá±_ááá·áº áá° áá±_áá²á· á¡á¯á¶_ááᯠáá»á¬áž ááœá¬áž áááá ááá¯áẠááá¯á·_á_áá±á¬á· á¡ááŒá¯á¶ááá¯áẠááœááº_áᬠááŒá®áž_áá¯áẠáááº_ááá¯_áᬠá¡á¬ážáá¯á¶áž_áá_áጠááŸá¬_áá«_á
ááŸá¯ááºáááºážáá®_áá±áž áááºáá±á¬á·_á_ááá² áá¯_áá±áž_ááẠáááº_áá¬_áᬠáá« áá¯ááº_ááœá¬áž ááŸá¬_ááá¯áž_ááá¯á· áá°áž áá±áž áá±á¬ áá°áž ááŒá®áž áá±á¬_ááẠáá²á·_ááẠáá»á
áº_ááœá¬áž_ááŒá® á¡áááºááŒá±_áá¬áž_ááŒáá¯áẠáá¬áž_ááŸáá·áº á¡áá¬áž_ááẠáááº_ááᯠáá¶áá«ááº_áá_áá¯á¶áž áá±á¬áº
Football_Observatory ááœááºáá±á¬ááºááẠááá¯_áá°ááá¯_áááºáž áá_á¡ááááºá·áá¯á¶áž_á¡ááŒá±á¬ááºážá¡ááœáŸá±á·_áá±áž á¡ááŒá
áº_áááºááŸááº_áá±á¬áºááŒ_áá¬áž áá«_áááº_á
áá¶áá¬ááá® ááŒá± ááá¯_áááºáž_áá áá±_ááŒá®_á
áááá_áá¯ááŸá
Ạááá¬ážáááŒá®áž_ááŸá¯_á¡ááŸááº_- áá
ááá¯ááºááŸá¬á manual word segmentation áá¯ááºáá¬ážáá²á· corpus áááºáž áááŸááá°áž ááá¯áááºáá±á¬á· myword á version á¡ááá¯áẠdefault á¡áá±áá²á· training áá¯ááºááŒá®áž áá¯á¶ážáá¬ážáá²á· dictionary ááá¯áá² áá¯á¶ážááŒá®áž phrase segmentation áá¯ááºáá»ááºááẠááá¯áááºáá±á¬á· á¡á±á¬ááºáá«á¡ááá¯ááºáž command áá±ážáá«á
$ python ./myword.py phrase ./test.space.txt ./test.phrase
{'command': 'phrase', 'threshold': 0.1, 'minfreq': 1, 'unigram_phrase_bin': 'unigram-phrase.bin', 'bigram_phrase_bin': 'bigram-phrase.bin', 'input': './test.space.txt', 'output': './test.phrase'}
computing phrases: threshold = 0.1 minfreq = 1
phrase segmentation...
- read unigram dictionary
- read bigram dictionary
- computing phrases..
- writing output..., filename: ./test.phrase
done.
áááºááŸá default áá¬ážáá¬ážáá²á· dictionary áá²á· ááŒááºááŒá®áž ááá¬áá²á· output á á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
$ cat ./test.phrase
áá»áœááºáá±á¬áº_á áá¯áá±áá ááá¬áž áá«_á
áá±á· áá±á¬ á áá±á¬_ááŒááºáá¬á
ᬠáá²á· ááœááºáá»á°áá¬_áá²á· áá² á¡áá¯áẠáá»á¬áž áá«_áááº
áááºáž_á áá±á¬_áᬠá¡áá¯ááº_áá¯áẠáá¬_áá² á
ááŒá±á¬_áጠáá«_á¡á¯á¶áž
áá±á¬áá® áááºáž áááº_áá±á¬áẠáá»ááº_ááẠááŒá±á¬ ááœá¬
ááá¹ááá±áž_ááŸá¬ áá±á«áº_á¡á±á¬ááºáááºážá
á¯ááŒáẠááááºá·ááœááºáž_ááŒá±á¬ ááẠáá²á· á
$ cat test.space.txt
áá»áœááºáá±á¬áº á áá¯áá±áá ááá¬áž áá« á
áá±á· áá±á¬ á áá±á¬ ááŒááºáá¬á
ᬠáá²á· ááœááºáá»á°áᬠáá²á· áá² á¡áá¯áẠáá»á¬áž áá« áááº
áááºáž á áá±á¬ áᬠá¡áá¯áẠáá¯áẠáᬠáá² á
ááŒá±á¬ áጠáá« á¡á¯á¶áž
áá±á¬áá® áááºáž ááẠáá±á¬áẠáá»áẠááẠááŒá±á¬ ááœá¬
ááá¹ááá±áž ááŸá¬ áá±á«áº á¡á±á¬ááºáááºážá
á¯ááŒáẠááááºá·ááœááºáž ááŒá±á¬ ááẠáá²á· á
ááááºááá¯á· ááá¯ááºá· word segmented corpus áá²á· á¡áá»áá¯ážáá»áá¯áž training/experiment áá¯ááºáá¬ážááŒá®áž ááá¯ááºáá¯á¶ážáá»ááºáá²á· dictionary ááᯠcommand line argument á¡áá±áá²á· assign áá¯ááºááŒá®áž áá¯á¶ážáá»ááºááẠááá¯áááºáá±á¬á· á¡á±á¬ááºáá«á¡ááá¯ááºáž run áá«á
python ./myword.py phrase --unigram_phrase_bin ./unigram-phrase.bin --bigram_phrase_bin ./bigram-phrase.bin ./test2.txt ./test2.phrase
$ python myword.py -h
ááá¯ááŒá®áž command áá±ážááá¯ááºááẠmyWord Segmentation Tool áá²á· "main-help screen" ááᯠááŒááºáááŸá¬ ááŒá
áºáá«áááºá
$ python myword.py -h
usage: myword [-h] [-v]
{syllable,build_dict,word,train_phrase,phrase,npmi_train} ...
Syllable, Word, Phrase Segmenter for Burmese (Myanmar language)
positional arguments:
{syllable,build_dict,word,train_phrase,phrase,npmi_train}
syllable syllable segmentation with Regular Expression
build_dict building n-gram dictionaries for word segmentation
word word segmentation with Vitabi algorithm proposed by
Andrew James Viterbi, 1967
train_phrase training or building n-gram dictionaries for phrase
segmentation
phrase phrase segmentation with NPMI (Normalized Pointwise
Mutual Information) proposed by Bouma Gerlof, 2009
npmi_train training or building n-gram dictionaries with NPMI and
run segmentation experiment for x-unit (e.g.
character, syllable, sub_word, word) with built
dictionaries, the learning x-unit will depends on your
input file segmentation
optional arguments:
-h, --help show this help message and exit
-v, --version output version information and exit
áá® áá±áá¬ááŸá¬ sub_option áá áºáᯠáá»ááºážá á®áá²á· á¡áá¯ááºááᯠá¡ááŒááºážááŸááºážáááẠá¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
- syllable (syllable segmentation áá¯ááºááá¯á·á¡ááœáẠáá¯á¶ážáá²á· option áá«)
- build_dict (unigram, bigram á¡áááá¬ááºááœá±ááᯠáá±á¬ááºááá¯á·á¡ááœáẠáá¯á¶ážáá²á· option áá«)
- word (Viterbi algorithm ááᯠáá¯á¶ážááŒá® word segmentation áá¯ááºááá¯á·á¡ááœáẠáá¯á¶ážáá²á· option áá«)
- train_phrase (unigram, bigram á á¬áá¯á¶ážá¡áááá¬áẠááŸá áºáá¯áá±á¬ááºááŒá®áž NPMI áá²á· á áá¬ážáá¯á¶ážááœá²ááœá± ááá¯á·ááá¯áẠphrase ááœá±ááᯠááœá²áá¯ááºááá¯á·á¡ááœáẠáá¯á¶ážáá²á· option áá«)
- phrase (NPMI algorithm áá²á· phrase segmentation áá¯ááºááá¯á·á¡ááœáẠáá¯á¶ážáá²á· option áá«)
- npmi_train (áá® option á NPMI algorithm áá²á· training, segmentation ááᯠáááŒáááºáááºáá áá¯ááºááá¯á·á¡ááœáẠáá¯á¶ážáá²á· option áá«)
"syllable", "build_dict", "word", "train_phrase", "phrase" and "npmi_train" option áá áºáá¯áá»ááºážá á®á¡ááœáẠhelp screen ááᯠcommand-line-help-of-myword page ááᯠáááºáá±á¬ááºááŒá®áž áá±á·áá¬áá«á
ááááºá NPMI unsupervised approach áá²á· phrase ááœá±áᬠáááá² character sequence, syllable, sub_word, word á áá²á· segmentation unit ááœá±ááá¯áááºáž learn áá¯ááºááŒá®áž ááœá²áá¯ááºáá±ážááá¯ááºáá«áááºá á¡á²áá®á¡ááœáẠlearning/segmentation á¡áá¯ááºááᯠá¡áá»áá¯ážáá»áá¯áž experiment áá¯ááºááá¯ááºááá¯á·á¡ááœáẠ"npmi_train" ááᯠmyWord Segmentation Tool áá²á· facility áá áºáá¯á¡áá±áá²á· áááºá·áá±ážáá¬ážáá¬áá«á
áá¬ážáááºááœááºá¡á±á¬áẠcorpus á¡áá±ážáá±ážáá áºáá¯áá±á¬ááºááŒá®ážáá±á¬á· run ááŒááºá·ááŒáá¡á±á¬ááºá ááá¯ááŒáá«á áá¯á· áá»áœááºáá±á¬áºááá¯á·áá²á· corpus ááŸá¬á áááºáááºáááá¯áá²á·ááŒáá²á· ááá»á¬ááá¬ááŒá®áž á¥á®ážáááºááá¯ážáá²á· "áá áá" ááá»á¬ááᯠááá¯ááºáááºá·áá¬ážáá²á· á á¬ááŒá±á¬ááºážááœá±ááŸááááºááá¯á·á áá áºáá¯ááŸááá¬á npmi_train áá²á· learn áá¯ááºááá¯á·á segmentation boundary áá áºáá¯áá±á¬á· áá±ážáááŸá¬ááá¯á· syllable áá áºáá¯áá»ááºážá á®ááᯠspace ááŒá¬ážááŒá®áž ááá¯ááºáááºá·áá¬ážáá«áááºá á¡á²áá® corpus ááá¯ááºá¡áá±ážáá±ážá á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
$ cat ./mama_wawa_poem.txt
á á á á
á á á
á¡ á á á á á
á áá« á áá«
á á áá¬
á á á áᬠáá¬
á á¡ áá«
áá« á
ᬠá
á á á á
á á á á
myWord Segmentation Tool áá²á· npmi_train option ááᯠáá¯á¶ážááŒá®ážáá±á¬á· segmentation experiment á¡áá±ážáá±ážáá áºáᯠáá¯ááºááŒááºá·ááŒáá¡á±á¬ááºá
- -lr ááá¯á·ááá¯áẠ--iteration_range ááᯠ"1,2" áá¬ážáááºá ááœá²áá¯ááºáááºá· á á¬áá¯á¶áž length á 2 to 4 ááá¯ááŒá®áž áááºááŸááºáá±ážááá¯ááºáá¬áá«á
- -tr ááá¯á·ááá¯áẠ--threshold_range ááá¯áá±á¬á· "0.1,0.1" ááá¯ááŒá®áž áá¬ážááá¯ááºáááºá ááá¯ááá¯áá¬á corpus ááááºáž á á¬ááŒá±á¬ááºážáá± ááááŒá±á¬ááºážáá² ááŸáááŒá®áž á¡áááºážáá±ážáá¬ááŒá±á¬ááºá· threshold value ááá¯áá±á¬á· ááá á¬ážáá±á¬á·áá°ážá
- -fr ááá¯á·ááá¯áẠ--minfreq_range ááá¯áá±á¬á· "2,3" ááá¯ááŒá®áž áááºááŸááºááá¯ááºáááºá corpus áá²ááŸá¬ á¡áááºážáá¯á¶áž ááŸá áºáá« ááá± áá¯á¶ážáá«ááŒá¬áž áá«ááŸáá² phrase á¡ááŒá áºáááºááŸááºááá¯á· áááºá·ááœááºážá ááºážá á¬ážáá« ááá¯á· setting áá¯ááºáá¬áá«á áá®áá±áá¬ááŸá¬áá±á¬á· phrase ááá¯áá¬á syllable ááœá²ááœá± áá²ááŒá áºáá¬ááŸá¬áá«á áá¬ááŒá±á¬ááºá·áá² ááá¯áá±á¬á· input áá¯ááºáááºá· training corpus áá²ááŸá¬ ááŒááºáá¬ážáá¬á á¡áááºááŸá¬ ááŒáá²á·áááᯠsyllable breaking áá¯ááºáá¬ážáá¬ááŒá±á¬ááºá·áá«á
ááááºáááºáž run áá²á·á¡áá«ááŸá¬áá±á¬á· á¡á±á¬ááºáá« á¡ááá¯ááºáž command áá±ážááŒá®ážáá±á¬á· myword.py ááᯠrun ááŒááºá·áá«á
$ time python ./myword.py npmi_train -lr "1,2" -tr "0.1,0.1" -fr "2,3" ./mama_wawa_poem.txt
corpus ááááºáž áá¡á¬ážáá±ážáá¬ááŒá±á¬ááºá· training áá¯ááºáá²á· á¡áá»áááºá áá
áá¹áááºá·á¡ááœááºážááŸá¬áá² ááŒá®ážááœá¬ážáá«ááááºá·áááºá
learning áá¯ááºááŒá®áž ááá¬áá²á· á
á¬áá¯á¶ážááœá±ááŒááºáá±ážáá¬ážáá²á· (i.e. segmented output file) ááá¯ááºááœá±ááᯠcommand-line ááŸá¬ ááá¯ááºáá¯ááºáá±ážááá¯á·á¡ááœáẠá¡á±á¬ááºáá«ááá¯áá»áá¯áž command áá±ážááá¯á· ááá«áááºá
for i in mama_wawa_poem.txt.l{1..2}.t0.1.f{2..3}.seg;do echo -e "\n"$i":"; cat $i; done;
ááááá¯á¶áž á¡áá±áá²á· "l1.t0.1.f2" (i.e. iteration=1, threshold=0.1, minfreq=2) áá²á· "l1.t0.1.f3" (i.e. iteration=1, threshold=0.1, minfreq=3) ááá¯á·ááŸá áºáᯠá¡ááŒá¬áž ááá¬áá²á· segmented output ááá¯áẠááŸá áºááá¯ááºááᯠside-by-side ááŸáá¯ááºážááŸááºááŒááºá·ááŒáá¡á±á¬ááºá Underscore "_" áá²á· ááœá²áá±ážáá¬ážáá¬á NPMI algorithm áá²á· learn áá¯ááºááŒá®áž ááá¬áá²á· á á¬áá¯á¶ážááœá²ááœá±áá«á frequency=3 á¡ááŒá Ạááá¯ážááá¯ááºáá²á·á¡áá«ááŸá¬ ááœá²áá¯ááºááá¯ááºáá²á· á á¬áá¯á¶ážá¡áá±á¡ááœááºá áááºážááœá¬ážáá¬ááᯠááŒááºááœá±á·ááá«ááááºá·áááºá á¡á²áá«ááŒá±á¬ááºá· "npmi_train" ááᯠáá¯á¶ážááŒá®áž phrase ááœá±ááᯠááœá²áá¯ááºáá²á· á¡áá«ááŸá¬ frequency ááá¯áá²á· setting ááááºáž ááá¯ááºá· corpus áá²á· ááá¬áá¡áá±á«áºááᯠáá°áááºááŒá®áž áá»áááºáááŒá®ážá០áááºááŸááºáá«á
mama_wawa_poem.txt.l1.t0.1.f2.seg | mama_wawa_poem.txt.l1.t0.1.f3.seg |
---|---|
|
|
áá®áá áºáá«áá±á¬á· á¡áá±áá²á· "l2.t0.1.f2" (i.e. iteration=2, threshold=0.1, minfreq=2) áá²á· "l2.t0.1.f3" (i.e. iteration=1, threshold=0.1, minfreq=3) ááá¯á·ááŸá áºáᯠá¡ááŒá¬áž NPMI á learn áá¯ááºááŒá®áž ááá¬áá²á· segmented output ááá¯áẠááŸá áºááá¯ááºááᯠside-by-side ááŸáá¯ááºážááŸááºááŒááºá·ááŒáá¡á±á¬ááºá "iteration" ááᯠtwo pass áá¯ááºááá¯ááºáá¬ááŒá±á¬ááºá· syllable áá±ážáá¯á¶ážááœá²á á¬áá¯á¶ážááœá± á¡áá ááœá²áá¯ááºáá°áá¬ááá¯ááºáá¬ááᯠ"mama_wawa_poem.txt.l2.t0.1.f2.seg" ááá¯ááºáá²ááŸá¬ áááºáááºááŸá¬ážááŸá¬áž ááŒááºááá«ááááºá·áááºá ááá¯á·áá±á¬áº "min-freq" ááᯠ"3" á¡ááŒá Ạáá¬ážáá¬ážááá¯ááºáá²á· á¡áá«ááŸá¬áá±á¬á· corpus áá²ááŸá¬á áá¯á¶ážáá« áááŸááá¬ááŒá±á¬ááºá· syllable ááŸá áºáá¯á¶ážááœá²á á¬áá¯á¶ážááœá± (i.e. á_á) ááá¯áá² "mama_wawa_poem.txt.l2.t0.1.f3.seg" ááá¯ááºáá²ááŸá¬ áá«áá¬áá¬ááᯠááœá±á·ááá«ááááºá·áááºá ááŒá±á¬ááááºáá±á¬á· "npmi_train" argument ááᯠáá¯á¶ážáá²á·á¡áá«ááŸá¬ option áá¯á¶ážáá¯ááŒá áºáá²á· "--iteration_range", "--threshold_range" áá²á· "--minfreq_range" áá¯á¶ážáá¯á áá¯á¶ážá á¡áá±ážááŒá®ážáá«áááºá á¡á²áá® parameter áá¯á¶ážáá¯á¡áá±á«áºááᯠáá°áááºááŒá®ážáá±á¬á· ááá¬áá²á· phrase ááœá±ááááºáž á¡ááŒá±á¬ááºážá¡áá² ááŒá áºááœá¬ážááŸá¬ ááŒá áºáá«áááºá Experiment ááᯠá¡áá»áá¯ážáá»áá¯áž áá¯ááºááŒááºá·ááŒáá«ááá¯á· á¡ááŒá¶áá±ážáá»ááºáá«áááºá
mama_wawa_poem.txt.l2.t0.1.f2.seg | mama_wawa_poem.txt.l2.t0.1.f3.seg |
---|---|
|
|
áá® README ááá¯ááºááŸá¬ ááŸááºááááœááºááŒá®ážáá±á¬á· ááŒááºáá¬á¡á±á¬áẠááŸááºážááŒááá¯ááºááá¯á·á¡ááœáẠááááºáá¯ááºáá²á·áá²á· "áá áá" experiment log ááá¯ááºááᯠáááºážáááºáá±ážáá¬ážáá«áááºá
Link: https://github.com/ye-kyaw-thu/myWord/blob/main/documentation/mama_wawa-exp1.md
á
á¬ááŒá±á¬ááºážáá± áá
áºáá±á¬ááºááŸááá²á· corpus áá²á· á
ááºážááŒáá¬ážáá¬ááá¯áááºáž áá±á·áá¬ááá¯ááºá¡á±á¬áẠáááºáá±ážáá¬ážáá«áááºá á¡á±á¬ááºáá« link ááŸá¬ áááºááŒááºá·áá«á
https://github.com/ye-kyaw-thu/myWord/blob/main/documentation/npmi_train-option-test-with-1k-corpus.md
Current Version: Version 1.0
Word á¡ááœááºáá±á¬ Phrase á¡ááœááºáá±á¬ default áá±á¬ááºáá±ážáá¬ážáá²á· ngram dictionary ááœá±á ./dict_ver1/ ááá¯áá²á· folder á¡á±á¬ááºááŸá¬ ááŸááá±áá«ááááºá·áááºá
- unigram-word.bin
- unigram-word.txt
- bigram-word.bin
- bigram-word.txt
- unigram-phrase.bin
- unigram-phrase.txt
- bigram-phrase.bin
- bigram-phrase.txt
â myWord Segmentation Tool ááᯠááá¯ááºá·á
ááºáá²ááŸá¬ download áá¯ááºááŒá®ážááá¯á· run ááá¯ááºáááºááŸá¬ combine-all-splitted-files.sh ááᯠá¡ááẠrun ááá¯á· ááá±á·áá«áá²á·á
(split-lt-24mb.sh á ááá¯ááºááœá±ááᯠsmall ááá¯ááºááœá±á¡ááŒá
áºááœá²ááá¯á·á¡ááœáẠrun áá²á·áá²á· script, áá® ááá¯ááºá run á
áᬠáááá¯áá°áž)
Coding ááᯠáááºááŒááºáá»ááºáá²á· áá°áá»á¬ážá¡ááœááºá...
- myword.py (main program of myWord Segmentation Tool)
- phrase_segment.py (module for phrase segmentation and training with NPMI Algorithm)
- syl_segment.py (module for syllable segmentation)
- word_dict.py (module for word unit ngram dictionary building)
- word_segment.py (module for word segmentation with Viterbi Algorithm)
myWord Segmentation Tool ááᯠdownload áá¯ááºááŒá®ážáá¬áá²á· ááá¯ááºá·á ááºáá²ááŸá¬ testing áá¯ááºááŒááºá·ááá¯á·á¡ááœáẠááŒááºáá¬á á¬áá±áá¬ááá¯ááºááœá±á...
- test1.txt (á á¬ááŒá±á¬ááºáž ááŒá±á¬ááºááŒá±á¬ááºážáá² ááŸááá²á· ááŒááºáá¬á ᬠUTF-8 text ááá¯ááºá space ááœá±ááᯠá á¬ááŒá±á¬ááºážááá¯ááºážááá¯ááᯠááŒá¯ááºáá¬ážááŒá®ážáá¬áž)
- test2.txt (word ááŒááºáá¬ážáá²á· ááŒááºáá¬á ᬠUTF-8 text ááá¯ááºá á á¬ááŒá±á¬ááºáž á¡áá±á¡ááœááºá á á¯á á¯áá±á«ááºáž á¡ááŒá±á¬ááºáž áá áá²á· word á¡áá±á¡ááœááºá á á ááá¯á¶áž ááŸááááº)
- mama_wawa_poem.txt (syllable segmentation ááŒááºáá¬ážáá²á· ááá»á¬ááá¬ááŒá®áž á¥á®ážáááºááá¯ážáá²á· "áá áá" ááá»á¬ááá¯ááºáá«á npmi_train experiment á¡ááœáẠááá°áᬠáá¯á¶ážááŒáá¬ážáá²á· input ááá¯ááºáá«)
áááºááŸá Folder ááœá±áá²á· áááºáááºááŒá®áž ááŒá±á¬ááŒááááº...
- dict_ver1/ (myWord corpus ááᯠáá¯á¶ážááŒá®ážáá±á¬á· áá±á¬ááºáá¬ážáá²á· ngram dictionary version.1.0 ááᯠááááºážáá¬ážáá²á· folder)
- documentation/ (README ááá¯ááºááŸá¬ áá¯á¶ážáá¬ážáá²á· figures ááœá±, experiment/running log files ááá»áá¯á·)
- tools/ (áá® folder á¡á±á¬ááºááŸá¬áá±á¬á· preprocessing á¡áá¯ááºááá¯á·á myWord Segmentation Tool ááᯠrun ááá¯á·á¡ááœáẠááŒááºááá¬áá²á· ááá¯ááºáá²á· script ááœá±á input ááá¯ááºá¡áá±á«áºááᯠáá°áááºááŒá®áž segmentation áá¯ááºááŒá®ážááœá¬ážáá²á·á¡áá«ááŸá¬ ááá¯áá±áá²á· space ááœá±ááŸáááẠspace cleaning áá¯ááºááá¬áá»áá¯ážáááºáž ááŸááááºááá¯á·... á¡áá¯á¶ážáááºááá¯ááºáááºá· script ááœá±ááᯠáááºá·áá±ážáá¬ážáá«áááº)
áááºááŸá release ááá¯ááºááẠá ááºážáá±áá²á· ngram dictionary ááœá±áá²á· evaluation áá¯ááºáá¬ážáá²á· ááááºááœá±ááá¯áááºáž áá±á·áá¬ááá¯á· áá¡á±á¬áẠREADME ááá¯ááºááŸá¬ áááºáá±ážáá¬ážááá¯ááºáá«áááºá (á¡áá»áááºááá²á·áááºáá±á¬á· ngram á¡áááá¬ááºááœá±ááᯠcleaning áááºáá¯ááºááŒá®áž áááºááá¯á· áááºááœááºáá¬ážáá«áááºá á¡á²áá«ááá¯ááẠááááºááœá±á áááºááŸá áááºáá±á¬áẠááá¯áá±á¬ááºážáá¬ááá¯ááºáá«áááº)
"Closed testing" ááá¯áá¬á ngram á¡áááá¬ááºááᯠáá±á¬ááºáá²á·á¡áá»áááºááŸá¬ áá¯á¶ážáá¬ážáá²á· corpus áá²á á á¬ááŒá±á¬ááºážááœá±áá²á·áá² word segmentation áá¯ááºááŒááºá·ááŒá®áž test áá¯ááºáᬠááŒá áºáá«áááºá Closed test á¡ááœáẠáá¯á¶ážáá²á·áá²á· test ááá¯ááºá á á¬ááŒá±á¬ááºážáá± á á¯á á¯áá±á«ááºáž áááá áá«á á¡áá±ážá ááẠinformation á á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
- 1000 (no. of sentences)
- 38451 (no. of words)
- 477524 (no. of characters)
$ wc corpus2.1k
1000 38451 477524 corpus2.1k
word segmentation áá¯ááºááŒá®áž ááœááºáá¬áá²á· output ááá¯ááºáá²á· áááºáááºáá²á· á á¬ááŒá±á¬ááºážáá± á¡áá±á¡ááœááºá á á¬áá¯á¶ážáá±á¡áá±á¡ááœááºá áá²á· information á á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
$ wc ./corpus2.1k.word
1000 40280 479353 ./corpus2.1k.word
Closed test á¡ááœáẠevaluation result ááœá±á á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
$ perl ./gradews.pl ./corpus2.1k ./corpus2.1k.word
Sent Accuracy: 32.00% (320/1000)
Word Prec: 86.14% (34692/40275)
Word Rec: 90.24% (34692/38446)
F-meas: 88.14%
Bound Accuracy: 97.50% (141622/145257)
$ time python ./myword.py word ./corpus2.shuf.open-test ./corpus2.shuf.open-test.word
real 6m45.903s
user 6m45.519s
sys 0m0.316s
open test áá±áá¬á á á¬ááŒá±á¬ááºážáá± á á¯á á¯áá±á«ááºáž 5,626 ááŒá±á¬ááºážááŸáááŒá®ážáá±á¬á· á á¬áá¯á¶ážá¡áá±á¡ááœááºá 135,810 (áá áºááááºáž áá¯á¶ážáá±á¬ááºáž áá«ážáá±á¬áẠáá»á±á¬áº) ááŸááá«áááºá
$ wc ./corpus2.shuf.open-test
5626 135810 1775923 ./corpus2.shuf.open-test
$ wc ./corpus2.shuf.open-test.word
5626 144232 1784344 ./corpus2.shuf.open-test.word
input ááá¯ááºáá²á· á á¬ááŒá±á¬ááºážááá»áá¯á·ááᯠá¥ááá¬á¡ááá²á· ááŒááºá·ááá¯ááºááá¯á·á¡ááœáẠhead command áá²á· print áá¯ááºáá¬ážáá«áááºá
$ head ./corpus2.shuf.open-test
áááºá·
áá« á
ááºážá
á¬áž áááᯠá
ááºážá
á¬áž áá« á
áá°á· áá²á· á¡áá»ááºá¡á
á®áž áá±áž áááºáááºážáá»áẠááŸá¬ áá® ááᯠáá¬ááẠááẠááŒáá·áºáá¬áž áá²á· radiation level ááᯠááœá±á· á áᬠáá« ááááá¯á¶áž á¡ááŒááẠáá±á¬á· á áá¯áẠáá« áá°áž á
ááá®ážáá®ážáá¬áž áááẠááẠCOVID - 19 ááŒá±á¬ááºá· ááẠá áá±á¬ááºááá¯ááºáž ááŒáá¯ááºááœá² ááœáŸá±á·ááá¯ááºáž áá¬áž á ááẠá
áááááºááŒááºá
áá»áœááºáá±á¬áº á á
áááºáá¬áž á áá±á¬ááºáž áá²á· ááá¯á· áá¬áž
ááá¯áẠáá»áẠááá¯á· ááá¯áẠáá± áᬠá áá¯áẠáá°áž áᜠáááºáž á¡áá± ááœá± áááºáž á¡á
áºá ááœá± ááᯠááá¯ááºážáá
áºáá«ážáá¬áž ááœá± á áááºáž áá±á¬áº
ááá±á
ᬠááᯠááẠáá±á«áºáá® á
áœááºááŒá¯áẠáá²á· áááºáááºááœáẠáá»á¯á¶ áááºá¡á°áá»á±á¬ááºáž áá²á· á áá±á¬ ááááºá
ᬠá
á¬áž áá±á¬á· ááẠááᯠááẠáááºáž áá® á¡ááá¯ááºáž áá² á
áá»áœááºáá±á¬áº áááºáá°á· ááᯠááŸá¬ áá²á· áᬠáá²
á¡áá°ážááŒá¬ážáá¯á¶áž áá¬áž áá° á áá»ááºáá¯á¶áž áá»á¬áž ááẠá
myword segmentation tool á á á¬áá¯á¶ážááŒááºáá±ážááŒá®ážáá±á¬á· ááœááºáá¬áá²á· oputput ááá¯ááºáá²á· á á¬ááŒá±á¬ááºáž áá áºáá»áá¯á·ááá¯áááºáž input áá¯ááºáá²á·áá²á·ááá¯ááºáá²á· ááŸáá¯ááºážááŸááºááŒá®áž áá±á·áá¬ááá¯ááºá¡á±á¬ááºááá¯á· head command áá¯á¶ážááŒá®áž print áá¯ááºáá±ážáá¬ážáá«áááºá
$ head ./corpus2.shuf.open-test.word
áááºá·
áá« á
ááºážá
á¬áž áááᯠá
ááºážá
á¬áž áá« á
áá°á· áá²á· á¡áá»ááºá¡á
á®áž áá±áž áááºáááºážáá»áẠááŸá¬ áá® ááᯠáá¬ááẠááẠááŒáá·áºáá¬áž áá²á· radiation level ááᯠááœá±á· á áᬠáá« ááááá¯á¶áž á¡ááŒááẠáá±á¬á· á áá¯áẠáá« áá°áž á
ááá®ážáá®ážáá¬ážáááẠááẠCOVID-19 ááŒá±á¬ááºá· ááẠá áá±á¬ááºááá¯ááºáž ááŒáá¯ááºááœá² ááœáŸá±á·ááá¯ááºáž áá¬áž á ááẠá
áááááºááŒááºá
áá»áœááºáá±á¬áº á á
ááẠáá¬áž á áá±á¬ááºáž áá²á· ááá¯á· áá¬áž
ááá¯áẠáá»áẠááá¯á· ááá¯áẠáá± áᬠá áá¯áẠáá°áž áᜠáááºáž á¡áá± ááœá± áááºáž á¡á
áºá ááœá± ááᯠááá¯ááºáž áá
Ạáá«áž áá¬áž ááœá± á áááºáž áá±á¬áº
á áá± á
ᬠááᯠááẠáá±á«áºáá® á
áœááºááŒá¯áẠáá²á· áááºáááºááœáẠáá»á¯á¶ áááºá¡á°áá»á±á¬ááºáž áá²á· á áá±á¬ ááááºá
ᬠá
á¬áž áá±á¬á· ááẠááᯠááẠáááºáž áá® á¡ááá¯ááºáž áá² á
áá»áœááºáá±á¬áº ááẠáá°á· ááᯠááŸá¬ áá²á· áᬠáá²
á¡áá°ážááŒá¬ážáá¯á¶áž áá¬áž áá° á áá»ááºáá¯á¶áž áá»á¬áž ááẠá
Open test á¡ááœáẠevaluation result ááœá±á á¡á±á¬ááºáá«á¡ááá¯ááºážáá«á
$ perl ./gradews.pl ./corpus2.shuf.open-test ./corpus2.shuf.open-test.word
Sent Accuracy: 33.99% (1912/5626)
Word Prec: 85.52% (123295/144179)
Word Rec: 90.81% (123295/135773)
F-meas: 88.08%
Bound Accuracy: 97.60% (531488/544530)
á¡áááºááŸá¬ syllable, word, phrase segmentation ááœá±áá²á· áááºáááºááŒá®áž á¡áá±ážá ááẠááŸááºážááŒáá²á·ááŒá®ážáá¬áž ááŒá áºáá±áá²á· advanced user ááœá±á áá¯á¶ážáá°ážááŒá®ážáá¬ážáá°ááœá±á áá¯ááºáááẠáá±á¬ááºáá¯á¶ážáá²á·á¡áá«ááŸá¬ á¡áááºááŒá±ááá¯ááºá á±ááá¯á·á¡ááœáẠoutput ááœá± ááŒáá±ážááá±áá±á¬á·áá² run ááááºá· command ááœá±ááá¯áá² áá®áá±áá¬á០á á¯ááŒá®ážáá»áá±ážáá±ážáá¬ážáá«áááºá
Syllable segmentation
Syllable segmentation áá²á· ááá¯ááºáá²á· command áá»á¬áž
- $ python myword.py syllable -h
- $ python myword.py syllable one_line.txt one_line.syllable
- $ python myword.py syllable -d "|" one_line.txt one_line.syllable
Word segmentation
Word segmentation áá²á· ááá¯ááºáá²á· command áá»á¬áž
- $ python myword.py word -h
- $ python myword.py word one_line.txt one_line.word
- $ python myword.py word -d "|" one_line.txt one_line.word
- $ python myword.py word --unigram_word_bin ./dict_ver1/unigram-word.bin --bigram_word_bin ./dict_ver1/bigram-word.bin -d "/" one_line.txt one_line.word
Phrase segmentation
Phrase segmentation á¡áá¯ááºáá²á· ááá¯ááºáá²á· command áá»á¬áž
- $ python ./myword.py phrase -h
- $ python ./myword.py phrase ./one_line.txt ./one_line.phrase
- $ python ./myword.py phrase --unigram_phrase_bin ./dict_ver1/unigram-phrase.bin --bigram_phrase_bin ./dict_ver1/bigram-phrase.bin ./one_line.txt ./one_line.phrase
ngram dictionary building for word segmentation
ááá¯ááºá·ááŸá¬ ááŸááá²á· corpus áá²á· ngram á¡áááá¬ááºááœá± áá±á¬ááºááŒá®áž word segmentation áá¯ááºáááºá· áá°áá»á¬ážá¡ááœááº
- $ python myword.py build_dict -h
- $ python ./myword.py build_dict ./corpus2.1k
- $ python ./myword.py build_dict --unigram_word_txt ./unigram-word.txt --bigram_word_txt ./bigram-word.txt --unigram_word_bin ./unigram-word.bin --bigram_word_bin ./bigram-word.bin ./corpus2.1k
training for phrase segmentation
ááá¯ááºá·áá±áá¬áá²á· ááá¯áẠmanual word segmentation áá¯ááºáá¬ážáá²á· corpus áá¯á¶ážááŒá®ážáá±á¬á· ngram á¡áááá¬ááºááœá±áá±á¬ááºáááºá phrase ááœá±ááᯠááœá²áá¯ááºááŒááºá·áá»ááºáá²á· áá°áá»á¬ážá¡ááœááº
- $ python myword.py train_phrase -h
- $ python ./myword.py train_phrase -l 2 -t 0.1 -f 3 --unigram_phrase_txt unigram.l2.t0.1f3.txt --bigram_phrase_txt bigram.l2.t0.1f3.txt --unigram_phrase_bin unigram.l2.t0.1f3.bin --bigram_phrase_bin bigram.l2.t0.1f3.bin ./corpus.txt ./corpus.l2t0.1f3.phrase
- $ python ./myword.py train_phrase -l 2 -t 0.1 -f 2 ./corpus2.1k ./corpus2.1k.l2t0.1f2.phrase
Unsupervised segmentation experiment with NPMI
ááá¯ááºáááºáá²ááŸá¬ ááŸááá²á· Corpus áá áºáá¯áá¯ááᯠáá¯á¶ážááŒá®ážáá±á¬á· NPMI training, x-unit segmentation áá²á· áááºáááºáá²á· experiment ááœá±ááᯠáá¯ááºááŒááºá·áá»ááºáá²á· áá°áá»á¬ážá¡ááœááº
- $ python myword.py npmi_train -h
- $ python ./myword.py npmi_train -lr "1,2" -tr "0.1,0.1" -fr "2,3" ./mama_wawa_poem.txt
myWord Corpus ááᯠáá±áá±áá»á¬áá»á¬ develop áá¯ááºááŒá áºáá²á·áá¬ááá±á¬á· á¡áááºážáá¯á¶áž áááŸá áºáá±á¬áẠááŸááá±áá«ááŒá®á á á¬ááŒá±á¬ááºážááœá±á áá»áœááºáá±á¬áºááá¯ááºááá¯áẠBBC, VOA á á á¯áá±á¬ááºážáá¬ážáá²á·áá²á· ááááºážáá±á¬ááºážáá«ážááœá±á áá»á±á¬ááºážáá¬ážááá»áá¯á·áá²á· á¡áá°áá¯ááºáá²á·áá²á· NLP project ááœá±á¡ááœáẠááŒááºáááºáá²á·ááŒáá²á· ááŒááºáá¬á ᬠá á¬ááŒá±á¬ááºážááœá±á 2019 áá¯ááºážá UTYCC ááŸá¬ áááºááŒá¬ážáá²á·áá²á· NLP class á áá»á±á¬ááºážáá¬ážááœá±áá²á· NLP Lab., UTYCC á member ááœá±ááᯠmanual word segmentation á¡ááœá±á·á¡ááŒá¯á¶áá¡á±á¬áẠáá áºáá±á¬ááºááᯠá á¬ááŒá±á¬ááºážáá± áá áºáá±á¬ááºá á® ááŸá¬ááœá± ááŒááºááá¯ááºážáá²á·áá¬ááœá±... á áááºááŒááºá· á¡áá»áá¯ážáá»áá¯ážááá¯á·ááá¯á· ááá¯ááááºáž á¡áá±áá²á·á general domain áá«áá²á myWord Word Segmentation Corpus á¡ááœáẠáá°áá®áá²á·áá²á·áá°á¡á¬ážáá¯á¶ážááᯠáá»á±ážáá°ážáááºááŒá±á¬ááºáž áá®áá±áá¬ááá± ááŒá±á¬ááŒá¬ážááá¯áá«áááºá áá¬áááºáá±á¬ááºá ááá¯ááºáá²á· affiliation ááœá±á áá°áá®áá²á·áá²á·á¡áá»áááºáá¯ááºážá ááŸááá±áá²á· affiliation ááœá±áá«á ááŸááºááááá±á¬áẠáá¬áááºááœá±ááᯠá¡á±á¬ááºáá«á¡ááá¯ááºáž á¡áá¹ááá¬á¡á á®á¡á ááºáá²á· áá»áá±ážááŒá®áž ááŸááºáááºážáááºáá±ážááá¯ááºáá«áááºá ááááºááá¯á· áá°áá®áá²á·ááŒá®ážáá±á¬á· áá±á¬áºááŒááá¯á·áá»ááºáá áºáá²á·áá²á· áá¬áááºááœá±ááŸááááºáááºáž ááœááºá·ááœáŸááºáá±ážááŒáá«á corpus áá²á áá±áá¬ááœá±ááᯠááŒááºá á áºáááºáž áá¬áááºááá¯ážááá¯á·ááá¯á¡ááºáááºáááºáž áááºááá¯ážááœá¬ážáá«áááºá
ðº áá»á±á¬á·áá±ááá¯áẠ(UTYCC, Myanmar) | ð» áá±á¬ááºážáááºá ᶠ(NLP Lab., UTYCC, Myanmar) | ð¹áááºááá·áºááá·áºááŸáá¯áẠ(NLP Lab., UTYCC, Myanmar) |
ð± áááºáá«áá«ááá¯áẠ(CSU, China) | ðŒ ááá·áºááá·áºáááºážááá·áº (UTYCC, Myanmar) | ðž áá»áá¯áááºáŠáž (UTYCC, Myanmar) |
ð áá»áá¯áá« (UTYCC, Myanmar) | ð· ááá¯ááºáá¯áá± (UTYCC, Myanmar) | ð ááá¯ááºáá¬ááœáẠ(UTYCC, Myanmar) |
ðº ááœááºááŸáá¯ááºááá¯áž (UTYCC, Myanmar) | ð» áá¬áá¬ááŸáá¯áẠ(KMITL, Thailand) | ð¹áááºáááá¬áŠáž (NLP Lab., UTYCC, Myanmar) |
ð± áááºážáá¯ááŸáá¯áẠ(UTYCC, Myanmar) | ðŒ áááºážááœáŸá±á ááºáá°áž (NLP Lab., UTYCC, Myanmar) | ðž áááºážá¡ááá¹ááŒá±áá»á±á¬áº (UTYCC, Myanmar) |
ð ááŸááºážáá¯ááŸáá¯áẠ(UTYCC, Myanmar) | ð· ááŸááºážá¡áá¡ááá»áᯠ(UTYCC, Myanmar) | ð ááŸááºážá¡á±ážáááºá· (UTYCC, Myanmar) |
ðº áá±á¬áºá¡ááºáá°ážá¡á±áž (YEC4Blind, Myanmar) | ð» ááá¯áá¹áᬠ(UTYCC, Myanmar) | ð¹ ááŒáá¯ážáá°ááẠ(NLP Lab., UTYCC, Myanmar) |
ð± ááŒáá¯ážáá±áá¬áá± (UTYCC, Myanmar) | ðŒ ááŒá°á ááºáá±áž (NLP Lab., UTYCC, Myanmar) | ðž áá»áá¯ážáá¬áááºáž (UTYCC, Myanmar) |
ð ááŒáá·áºááŒáá·áºáá±áž (UTYCC, Myanmar) | ð· ááŒááºááŒáááºážáá»ááºáž (UTYCC, Myanmar) | ð ááŒá¡áá ᶠ(SIIT, Thailand) |
ðº ááŸá¯á¶áá¶áá¬áá»á±á¬áº (NLP Lab., UTYCC, Myanmar) | ð» áá±áááºááœááºáž (NLP Lab., UTYCC, Myanmar) | ð¹ áá±ááŒáá¯ážá¡á±á¬áẠ(UTYCC, Myanmar) |
ð± áá±ááŒá°ááẠ(UTYCC, Myanmar) | ðŒ áá±ááŒááºááŒááºááá¯áẠ(UTYCC, Myanmar) | ðž áá²áá»á±á¬áºááááºáž (LU Lab., Myanmar) |
ð ááŸááŸáá±áž (UCSY, Myanmar) | ð· ááŸáá áºáá± (NLP Lab., UTYCC, Myanmar) | ð ááŸáá¯ááºáá±ááẠ(UTYCC, Myanmar) |
ðº áááºá·ááááºá¹áá® (YTU, Myanmar) | ð» áááºážáá°áá¬áá»á±á¬áº (Waseda Univ., Japan) | ð¹ áá±ááŸááºážá¡ááá¹ááŒá¬áá±á¬áẠ(UTYCC, Myanmar) |
ð± ááááºááŒááºá·á¥á®áž (UCSY, Myanmar) | ðŒ áá®áá¬á ááºáž (UTYCC, Myanmar) | ðž áá±áá¬ááºááœááºáž (UTYCC, Myanmar) |
ð áá±áá¬ááŒáá¯áž (NLP Lab., UTYCC, Myanmar) | ð· á¡áááŒá°ááŒá°ááœáẠ(UTYCC, Myanmar) | ð á¡áááá¹áá¬ááŒá° (UTYCC, Myanmar) |
ðº á¡á±ážááŒááºáá±á¬áºáá¬áŠáž (NLP Lab., UTYCC, Myanmar) | ð» á¥áá¹áá¬ááœááºáž (Nagaoka Univ., Japan) |
ð ááŸáá¯ááºááŒááºááœáẠ(NLP Lab., UTYCC, Myanmar) the highest contribution for myWord Corpus (Version 1.0) developing
ð Ye Kyaw Thu (Visiting Professor, LST, NECTEC, Thailand)
- writing brief English README file
- adding sub_word unit for NMT
- upload Word Segmentation Guideline for Burmese (Myanmar language)
- automatic spelling checking running on myWord corpus
- adding Beam decoding
- evaluation tool for segmentation?!
- dealing punctuation characters
- -z, --compress (enable compression of output e.g. zlib)
- -s, --split (Split segmented output file into small blocks)
- plan to support input with "folder" and "stdin"
myWord is MIT-licensed. The license applies to the pre-built unigram, bigram dictionaries as well.
Currently, please cite as:
myWord: Syllable, Word and Phrase Segmenter for Burmese, Ye Kyaw Thu, Sept 2021, GitHub Link: https://github.com/ye-kyaw-thu/myWord
- Viterbi, Andrew. Error bounds for convolutional codes and an asymptotically optimum decoding algorithm. IEEE transactions on Information Theory, 13(2):260â269, 1967 [Paper]
- Slade, George. (2013). The Viterbi algorithm demystified. Link:https://www.researchgate.net/publication/235958269_The_Viterbi_algorithm_demystified
- The Viterbi Algorithm Demystified, By Andrew J. Viterbi, March 16, 2017, Link: https://viterbischool.usc.edu/news/2017/03/viterbi-algorithm-demystified/
- Forney, G David. The Viterbi algorithm. Proceedings of the IEEE, 61(3):268â278, 1973, https://www2.isye.gatech.edu/~yxie77/ece587/viterbi_algorithm.pdf
- The Viterbi Algorithm at 50: https://viterbischool.usc.edu/news/2017/03/viterbi-algorithm-50/
- Backurs, A. & Tzamos, C.. (2017). Improving Viterbi is Hard: Better Runtimes Imply Faster Clique Algorithms. Proceedings of the 34th International Conference on Machine Learning, in Proceedings of Machine Learning Research, 70:311-321 http://proceedings.mlr.press/v70/backurs17a/backurs17a.pdf
- Python implementation of Viterbi algorithm for word segmentation A clean-up of this: (http://norvig.com/ngrams/ch14.pdf), https://gist.github.com/markdtw/e2a4e2ee7cef8ea6aed33bb47a97fba6
- Python Word Segmentation: https://github.com/grantjenks/python-wordsegment
- Beautiful Data, The Stories Behind Elegant Data Solutions, Toby Segaran, Jeff Hammerbacher, O'Reilly, 2009, Link: https://github.com/jhulick/bookstuff/blob/master/Oreilly%20-%20Beautiful%20Data.pdf
- Viterbi Algorithm for HMM Decoding, Link:https://www.cl.cam.ac.uk/teaching/1718/MLRD/slides/slides9.pdf
- Implement Viterbi Algorithm in Hidden Markov Model using Python and R Link: http://www.adeveloperdiary.com/data-science/machine-learning/implement-viterbi-algorithm-in-hidden-markov-model-using-python-and-r/
- Yining Wang, Long Zhou, Jiajun Zhang and Chengqing Zong, Word, Subword or Character? An Empirical Study of Granularity in Chinese-English NMT, CoRR, abs/1711.04457, 2017. [Paper]
- Evaluation perl script for word segmentation: https://raw.githubusercontent.com/neubig/nlptutorial/master/script/gradews.pl
- Experiment Note by Assoc. Prof. Daichi Mochihashi: http://chasen.org/~daiti-m/diary/
- Statistically recognize long phrases with Normalized PMI: http://chasen.org/~daiti-m/diary/misc/phraser.py
- Vector Semantics: https://courses.engr.illinois.edu/cs440/fa2018/lectures/lect36.html
- Lecture 17: Vector-space semantics (distributional similarities), Julia Hockenmaier: https://courses.engr.illinois.edu/cs447/fa2018/Slides/Lecture17HO.pdf
- Pointwise_mutual_information: https://en.wikipedia.org/wiki/Pointwise_mutual_information
- Dr. Thein Tun, Acoustic Phonetics and The Phonology of the Myanmar Language
- Romanization: https://en.wikipedia.org/wiki/Romanization
- Myanmar Unicode: http://unicode.org/charts/PDF/U1000.pdf
- Syllable segmentation algorithm of Myanmar text: http://gii2.nagaokaut.ac.jp/gii/media/share/20080901-ZMM%20Presentation.pdf
- Zin Maung Maung and Yoshiki Makami,"A rule-based syllable segmentation of Myanmar Text", in Proceeding of the IJCNLP-08 workshop of NLP for Less Privileged Language, January, 2008, Hyderabad, India, pp. 51-58. Paper
- Tin Htay Hlaing, "Manually constructed context-free grammar for Myanmar syllable structure", in Proceedings of the Student Research Workshop at the 13th Conference of the European Chapter of the Association for Computational Linguistics (EACL '12), Association for Computational Linguistics, Stroudsburg, PA, USA, pp. 32-37. Paper
- Ye Kyaw Thu, Andrew Finch, Yoshinori Sagisaka and Eiichiro Sumita, "A Study of Myanmar Word Segmentation Schemes for Statistical Machine Translation", in Proceedings of the 11th International Conference on Computer Applications (ICCA 2013), February 26~27, 2013, Yangon, Myanmar, pp. 167-179. Paper
- Ye Kyaw Thu, Andrew Finch, Win Pa Pa, and Eiichiro Sumita, "A Large-scale Study of Statistical Machine Translation Methods for Myanmar Language", in Proceedings of SNLP2016, February 10-12, 2016, Phranakhon Si Ayutthaya, Thailand. Paper
- Regular Expression: https://en.wikipedia.org/wiki/Regular_expression
- DebuggexBeter: https://www.debuggex.com/
- Chenchen Ding, Ye Kyaw Thu, Masao Utiyama, Eiichiro Sumita: Word Segmentation for Burmese (Myanmar). ACM Trans. Asian Low Resour. Lang. Inf. Process. 15(4): 22:1-22:10 (2016)
- Shaoning Zhang and Cunli Mao and Zhengtao Yu and Hongbin Wang and Z. Li and Jiafu Zhang, Word Segmentation for Burmese Based on Dual-Layer CRFs, ACM Transactions on Asian and Low-Resource Language Information Processing (TALLIP), Volume 18, 2019, pp. 1-11
- Burmese word segmentation program using Foma-generated Finite State Automata, Link: https://github.com/lwinmoe/segment