This is an Android project that adds Thai word breaking functionality to Android's TextView. Some of its features includes:
- processing speed with cached dictionary
- aesthetical modification to dictionary and algorithm customized only for line breaking
- auto disabling when ellipsis is applied
Here is the .apk demo
//TODO let Boom write this
The only class that you'd use is ThaiLineBreakingTextView which extends from TextView. It adds 2 additional methods:
public void setText2(int/CharSequence)
which should be used in replace of setText to process line break and then setTextpublic CharSequence getText2()
which would return the text you've set using setText2
Note: that the use of setText and getText by user should be avoided.
Tips: You can also layout this class is xml as follow <hnk.lib.tlb.ThaiLineBreakingTextView android:id="@+id/result"/>
The preprocessing of the dictionary and the dictionary caching is done in another project here. In this project, we only use the cached dict in file res/raw/trie_cache.txt and res/raw/whole_word_cache.txt