OpenPecha / Botok

🏷 བོད་ཏོག [pʰøtɔk̚] Tibetan word tokenizer in Python
https://botok.readthedocs.io/
Apache License 2.0
58 stars 15 forks source link

bad segmentation #68

Closed drupchen closed 4 years ago

drupchen commented 4 years ago
string = """བཀྲ་ཤིས་བདེ་ལེགས་ཕུན་སུམ་ཚོགས། རྟག་ཏུ་བདེ་བ་ཐོབ་པར་ཤོག
བཀྲ་ཤིས་བདེ་ལེགས་ཕུན་སུམ་ཚོགས། རྟག་ཏུ་བདེ་བ་ཐོབ་པར་ཤོག"""
t = Text(string)
print(t.tokenize_words_raw_lines)

gives as output:

བཀྲ་ཤིས་ བདེ་ལེགས་ ཕུན་སུམ་ ཚོགས །_ རྟག་ ཏུ་ བདེ་བ་ ཐོབ་པ ར་ ཤོག
བཀྲ་ ཤིས་ བདེ་ལེགས་ ཕུན་སུམ་ ཚོགས །_ རྟག་ ཏུ་ བདེ་བ་ ཐོབ་པ ར་ ཤོག

where བཀྲ་ ཤིས་ ought to be tokenized བཀྲ་ཤིས་ on the second line.

drupchen commented 4 years ago

after investigation, it appears the behaviour is normal, since ཤོག་བཀྲ་ is an existing word(shog bkra/ shog bu tshon khra sna tshogs can/).

The preprocessing correctly parses ཤོག\nབཀྲ་ into two distinct syllables, then checks the existence of ཤོག་བཀྲ་ in the trie. The \n is kept since it is a transparent character, so in the end, ཤོག\nབཀྲ་ gets the OTHER POS tag.

Closing the issue since botok works as expected.