Salmon Run: Tokenizing Test : Token Recognition
Last week I wrote about using ICU4j's RuleBasedBreakIterator to tokenize a body of text . Custom rules were added to customize the default BreakIterator behavior. Unlike the BreakIterators available in java.text, the ICU4j's RuleBasedBreakIterator exposes a nice getRuleStatus() method, which provides a good first cut at recognizing what kind of tokens are being returned. In this post, I refine the tokenization slightly by passing it through a chain of token recognizers. My latest customizations are shown here (minus the built in word rules which I generated. For the full file, see my previous post. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 !!chain; ... # Custom : Modified to add an optional trailing % sign $NumericEx = $Numeric ($Extend | $Format)*(\%)*; ... # ============= Custom Rules ================ # Abbreviation: Uppercase alpha chars separated by period and optionally followed by a period $Abbreviation = [A-Z](\.Read full article from Salmon Run: Tokenizing Test : Token Recognition
No comments:
Post a Comment