| OLD | NEW |
| 1 # | 1 # |
| 2 # Copyright (C) 2002-2013, International Business Machines Corporation | 2 # Copyright (C) 2002-2013, International Business Machines Corporation |
| 3 # and others. All Rights Reserved. | 3 # and others. All Rights Reserved. |
| 4 # | 4 # |
| 5 # file: word.txt | 5 # file: word_ja.txt |
| 6 # | 6 # |
| 7 # ICU Word Break Rules | 7 # ICU Word Break Rules |
| 8 # See Unicode Standard Annex #29. | 8 # See Unicode Standard Annex #29. |
| 9 # These rules are based on UAX #29 Revision 22 for Unicode Version 6.3 | 9 # These rules are based on UAX #29 Revision 22 for Unicode Version 6.3 |
| 10 # | 10 # |
| 11 # Note: Updates to word.txt will usually need to be merged into | 11 # Note: Updates to word.txt will usually need to be merged into |
| 12 # word_POSIX.txt also. | 12 # word_POSIX.txt also. |
| 13 | 13 |
| 14 ############################################################################## | 14 ############################################################################## |
| 15 # | 15 # |
| (...skipping 12 matching lines...) Expand all Loading... |
| 28 $LF = [\p{Word_Break = LF}]; | 28 $LF = [\p{Word_Break = LF}]; |
| 29 $Newline = [\p{Word_Break = Newline}]; | 29 $Newline = [\p{Word_Break = Newline}]; |
| 30 $Extend = [\p{Word_Break = Extend}]; | 30 $Extend = [\p{Word_Break = Extend}]; |
| 31 $Regional_Indicator = [\p{Word_Break = Regional_Indicator}]; | 31 $Regional_Indicator = [\p{Word_Break = Regional_Indicator}]; |
| 32 $Format = [\p{Word_Break = Format}]; | 32 $Format = [\p{Word_Break = Format}]; |
| 33 $Katakana = [\p{Word_Break = Katakana}]; | 33 $Katakana = [\p{Word_Break = Katakana}]; |
| 34 $Hebrew_Letter = [\p{Word_Break = Hebrew_Letter}]; | 34 $Hebrew_Letter = [\p{Word_Break = Hebrew_Letter}]; |
| 35 $ALetter = [\p{Word_Break = ALetter}]; | 35 $ALetter = [\p{Word_Break = ALetter}]; |
| 36 $Single_Quote = [\p{Word_Break = Single_Quote}]; | 36 $Single_Quote = [\p{Word_Break = Single_Quote}]; |
| 37 $Double_Quote = [\p{Word_Break = Double_Quote}]; | 37 $Double_Quote = [\p{Word_Break = Double_Quote}]; |
| 38 $MidNumLet = [\p{Word_Break = MidNumLet}]; | 38 # Remove two full stop characters from $MidNumLet and add them to $MidNum |
| 39 # to break a hostname into its components at the cost of breaking |
| 40 # 'e.g.' and 'i.e.' as well. |
| 41 # $MidNumLet is used in rules 6/7 (rules of our interest) and rules 11/12. |
| 42 # Because it's OR'd with $MidNum in rules 11/12, rules 11/12 are not affected |
| 43 # while rules 6/7 are reverted to the old behavior we want. |
| 44 $MidNumLet = [[\p{Word_Break = MidNumLet}] - [\u002E \uFF0E]]; |
| 39 $MidLetter = [\p{Word_Break = MidLetter}]; | 45 $MidLetter = [\p{Word_Break = MidLetter}]; |
| 40 $MidNum = [\p{Word_Break = MidNum}]; | 46 $MidNum = [\p{Word_Break = MidNum}[\u002E \uFF0E]]; |
| 41 $Numeric = [\p{Word_Break = Numeric}]; | 47 $Numeric = [\p{Word_Break = Numeric}[\uff10-\uff19]]; #includes fullwidth d
igits |
| 42 $ExtendNumLet = [\p{Word_Break = ExtendNumLet}]; | 48 $ExtendNumLet = [\p{Word_Break = ExtendNumLet}]; |
| 43 | 49 |
| 44 $Han = [:Han:]; | 50 $Han = [:Han:]; |
| 45 $Hiragana = [:Hiragana:]; | 51 $Hiragana = [:Hiragana:]; |
| 46 | 52 |
| 47 | 53 |
| 48 # Dictionary character set, for triggering language-based break engines. Curre
ntly | 54 # Dictionary character set, for triggering language-based break engines. Curre
ntly |
| 49 # limited to LineBreak=Complex_Context. Note that this set only works in Unico
de | 55 # limited to LineBreak=Complex_Context. Note that this set only works in Unico
de |
| 50 # 5.0 or later as the definition of Complex_Context was corrected to include a
ll | 56 # 5.0 or later as the definition of Complex_Context was corrected to include a
ll |
| 51 # characters requiring dictionary break. | 57 # characters requiring dictionary break. |
| 52 | 58 |
| 53 $Control = [\p{Grapheme_Cluster_Break = Control}]; | 59 $Control = [\p{Grapheme_Cluster_Break = Control}]; |
| 54 $HangulSyllable = [\uac00-\ud7a3]; | 60 $HangulSyllable = [\uac00-\ud7a3]; |
| 55 $ComplexContext = [:LineBreak = Complex_Context:]; | 61 $ComplexContext = [:LineBreak = Complex_Context:]; |
| 56 $KanaKanji = [$Han $Hiragana $Katakana]; | 62 $KanaKanji = [$Han $Hiragana $Katakana]; |
| 57 $dictionaryCJK = [$KanaKanji $HangulSyllable]; | 63 $dictionary = [$ComplexContext]; |
| 58 $dictionary = [$ComplexContext $dictionaryCJK]; | |
| 59 | 64 |
| 60 # leave CJK scripts out of ALetterPlus | 65 $ALetterPlus = [$ALetter [$ComplexContext-$Extend-$Control]]; |
| 61 $ALetterPlus = [$ALetter-$dictionaryCJK [$ComplexContext-$Extend-$Control]]; | |
| 62 | 66 |
| 63 | 67 |
| 64 # | 68 # |
| 65 # Rules 4 Ignore Format and Extend characters, | 69 # Rules 4 Ignore Format and Extend characters, |
| 66 # except when they appear at the beginning of a region of text. | 70 # except when they appear at the beginning of a region of text. |
| 67 # | 71 # |
| 68 # TODO: check if handling of katakana in dictionary makes rules incorrect/void | 72 # TODO: check if handling of katakana in dictionary makes rules incorrect/void |
| 69 $KatakanaEx = $Katakana ($Extend | $Format)*; | 73 $KatakanaEx = $Katakana ($Extend | $Format)*; |
| 70 $Hebrew_LetterEx = $Hebrew_Letter ($Extend | $Format)*; | 74 $Hebrew_LetterEx = $Hebrew_Letter ($Extend | $Format)*; |
| 71 $ALetterEx = $ALetterPlus ($Extend | $Format)*; | 75 $ALetterEx = $ALetterPlus ($Extend | $Format)*; |
| 72 $Single_QuoteEx = $Single_Quote ($Extend | $Format)*; | 76 $Single_QuoteEx = $Single_Quote ($Extend | $Format)*; |
| 73 $Double_QuoteEx = $Double_Quote ($Extend | $Format)*; | 77 $Double_QuoteEx = $Double_Quote ($Extend | $Format)*; |
| 74 $MidNumLetEx = $MidNumLet ($Extend | $Format)*; | 78 $MidNumLetEx = $MidNumLet ($Extend | $Format)*; |
| 75 $MidLetterEx = $MidLetter ($Extend | $Format)*; | 79 $MidLetterEx = $MidLetter ($Extend | $Format)*; |
| 76 $MidNumEx = $MidNum ($Extend | $Format)*; | 80 $MidNumEx = $MidNum ($Extend | $Format)*; |
| 77 $NumericEx = $Numeric ($Extend | $Format)*; | 81 $NumericEx = $Numeric ($Extend | $Format)*; |
| 78 $ExtendNumLetEx = $ExtendNumLet ($Extend | $Format)*; | 82 $ExtendNumLetEx = $ExtendNumLet ($Extend | $Format)*; |
| 79 $Regional_IndicatorEx = $Regional_Indicator ($Extend | $Format)*; | 83 $Regional_IndicatorEx = $Regional_Indicator ($Extend | $Format)*; |
| 80 | 84 |
| 81 $Ideographic = [\p{Ideographic}]; | 85 $Ideographic = [\p{Ideographic} [\u3005 \u3007 \u303B]]; |
| 82 $HiraganaEx = $Hiragana ($Extend | $Format)*; | 86 $HiraganaEx = $Hiragana ($Extend | $Format)*; |
| 83 $IdeographicEx = $Ideographic ($Extend | $Format)*; | 87 $IdeographicEx = $Ideographic ($Extend | $Format)*; |
| 84 | 88 |
| 85 ## ------------------------------------------------- | 89 ## ------------------------------------------------- |
| 86 | 90 |
| 87 !!forward; | 91 !!forward; |
| 88 | 92 |
| 89 | 93 |
| 90 # Rule 3 - CR x LF | 94 # Rule 3 - CR x LF |
| 91 # | 95 # |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 139 |
| 136 # rule 11 and 12 | 140 # rule 11 and 12 |
| 137 | 141 |
| 138 $NumericEx ($MidNumEx | $MidNumLetEx | $Single_QuoteEx) $NumericEx {100}; | 142 $NumericEx ($MidNumEx | $MidNumLetEx | $Single_QuoteEx) $NumericEx {100}; |
| 139 | 143 |
| 140 # rule 13 | 144 # rule 13 |
| 141 # to be consistent with $KanaKanji $KanaKanhi, changed | 145 # to be consistent with $KanaKanji $KanaKanhi, changed |
| 142 # from 300 to 400. | 146 # from 300 to 400. |
| 143 # See also TestRuleStatus in intltest/rbbiapts.cpp | 147 # See also TestRuleStatus in intltest/rbbiapts.cpp |
| 144 $KatakanaEx $KatakanaEx {400}; | 148 $KatakanaEx $KatakanaEx {400}; |
| 149 $HiraganaEx $HiraganaEx {400}; |
| 150 $IdeographicEx $IdeographicEx {400}; |
| 145 | 151 |
| 146 # rule 13a/b | 152 # rule 13a/b |
| 147 | 153 |
| 148 $ALetterEx $ExtendNumLetEx {200}; # (13a) | 154 $ALetterEx $ExtendNumLetEx {200}; # (13a) |
| 149 $Hebrew_LetterEx $ExtendNumLetEx {200}; # (13a) | 155 $Hebrew_LetterEx $ExtendNumLetEx {200}; # (13a) |
| 150 $NumericEx $ExtendNumLetEx {100}; # (13a) | 156 $NumericEx $ExtendNumLetEx {100}; # (13a) |
| 151 $KatakanaEx $ExtendNumLetEx {400}; # (13a) | 157 $KatakanaEx $ExtendNumLetEx {400}; # (13a) |
| 152 $ExtendNumLetEx $ExtendNumLetEx {200}; # (13a) | 158 $ExtendNumLetEx $ExtendNumLetEx {200}; # (13a) |
| 153 | 159 |
| 154 $ExtendNumLetEx $ALetterEx {200}; # (13b) | 160 $ExtendNumLetEx $ALetterEx {200}; # (13b) |
| 155 $ExtendNumLetEx $Hebrew_Letter {200}; # (13b) | 161 $ExtendNumLetEx $Hebrew_Letter {200}; # (13b) |
| 156 $ExtendNumLetEx $NumericEx {100}; # (13b) | 162 $ExtendNumLetEx $NumericEx {100}; # (13b) |
| 157 $ExtendNumLetEx $KatakanaEx {400}; # (13b) | 163 $ExtendNumLetEx $KatakanaEx {400}; # (13b) |
| 158 | 164 |
| 159 # rule 13c | 165 # rule 13c |
| 160 | 166 |
| 161 $Regional_IndicatorEx $Regional_IndicatorEx; | 167 $Regional_IndicatorEx $Regional_IndicatorEx; |
| 162 | 168 |
| 163 # special handling for CJK characters: chain for later dictionary segmentation | |
| 164 $HangulSyllable $HangulSyllable {200}; | |
| 165 $KanaKanji $KanaKanji {400}; # different rule status if both kana and kanji foun
d | |
| 166 | |
| 167 | |
| 168 ## ------------------------------------------------- | 169 ## ------------------------------------------------- |
| 169 | 170 |
| 170 !!reverse; | 171 !!reverse; |
| 171 | 172 |
| 172 $BackHebrew_LetterEx = ($Format | $Extend)* $Hebrew_Letter; | 173 $BackHebrew_LetterEx = ($Format | $Extend)* $Hebrew_Letter; |
| 173 $BackALetterEx = ($Format | $Extend)* $ALetterPlus; | 174 $BackALetterEx = ($Format | $Extend)* $ALetterPlus; |
| 174 $BackSingle_QuoteEx = ($Format | $Extend)* $Single_Quote; | 175 $BackSingle_QuoteEx = ($Format | $Extend)* $Single_Quote; |
| 175 $BackDouble_QuoteEx = ($Format | $Extend)* $Double_Quote; | 176 $BackDouble_QuoteEx = ($Format | $Extend)* $Double_Quote; |
| 176 $BackMidNumLetEx = ($Format | $Extend)* $MidNumLet; | 177 $BackMidNumLetEx = ($Format | $Extend)* $MidNumLet; |
| 177 $BackNumericEx = ($Format | $Extend)* $Numeric; | 178 $BackNumericEx = ($Format | $Extend)* $Numeric; |
| 178 $BackMidNumEx = ($Format | $Extend)* $MidNum; | 179 $BackMidNumEx = ($Format | $Extend)* $MidNum; |
| 179 $BackMidLetterEx = ($Format | $Extend)* $MidLetter; | 180 $BackMidLetterEx = ($Format | $Extend)* $MidLetter; |
| 180 $BackKatakanaEx = ($Format | $Extend)* $Katakana; | 181 $BackKatakanaEx = ($Format | $Extend)* $Katakana; |
| 181 $BackHiraganaEx = ($Format | $Extend)* $Hiragana; | 182 $BackHiraganaEx = ($Format | $Extend)* $Hiragana; |
| 183 $BackIdeographicEx = ($Format | $Extend)* $Ideographic; |
| 182 $BackExtendNumLetEx = ($Format | $Extend)* $ExtendNumLet; | 184 $BackExtendNumLetEx = ($Format | $Extend)* $ExtendNumLet; |
| 183 $BackRegional_IndicatorEx = ($Format | $Extend)* $Regional_Indicator; | 185 $BackRegional_IndicatorEx = ($Format | $Extend)* $Regional_Indicator; |
| 184 | 186 |
| 185 # rule 3 | 187 # rule 3 |
| 186 $LF $CR; | 188 $LF $CR; |
| 187 | 189 |
| 188 # rule 4 | 190 # rule 4 |
| 189 ($Format | $Extend)* [^$CR $LF $Newline]?; | 191 ($Format | $Extend)* [^$CR $LF $Newline]?; |
| 190 | 192 |
| 191 # rule 5 | 193 # rule 5 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 214 | 216 |
| 215 ($BackALetterEx | $BackHebrew_LetterEx) $BackNumericEx; | 217 ($BackALetterEx | $BackHebrew_LetterEx) $BackNumericEx; |
| 216 | 218 |
| 217 # rule 11 and 12 | 219 # rule 11 and 12 |
| 218 | 220 |
| 219 $BackNumericEx ($BackMidNumEx | $BackMidNumLetEx | $BackSingle_QuoteEx) $BackNum
ericEx; | 221 $BackNumericEx ($BackMidNumEx | $BackMidNumLetEx | $BackSingle_QuoteEx) $BackNum
ericEx; |
| 220 | 222 |
| 221 # rule 13 | 223 # rule 13 |
| 222 | 224 |
| 223 $BackKatakanaEx $BackKatakanaEx; | 225 $BackKatakanaEx $BackKatakanaEx; |
| 226 $BackHiraganaEx $BackHiraganaEx; |
| 227 $BackIdeographicEx $BackIdeographicEx; |
| 224 | 228 |
| 225 # rules 13 a/b | 229 # rules 13 a/b |
| 226 # | 230 # |
| 227 $BackExtendNumLetEx ($BackALetterEx | $BackHebrew_LetterEx | $BackNumericEx | $B
ackKatakanaEx | $BackExtendNumLetEx); | 231 $BackExtendNumLetEx ($BackALetterEx | $BackHebrew_LetterEx | $BackNumericEx | $B
ackKatakanaEx | $BackExtendNumLetEx); |
| 228 ($BackALetterEx | $BackHebrew_LetterEx | $BackNumericEx | $BackKatakanaEx) $Back
ExtendNumLetEx; | 232 ($BackALetterEx | $BackHebrew_LetterEx | $BackNumericEx | $BackKatakanaEx) $Back
ExtendNumLetEx; |
| 229 | 233 |
| 230 # rule 13c | 234 # rule 13c |
| 231 | 235 |
| 232 $BackRegional_IndicatorEx $BackRegional_IndicatorEx; | 236 $BackRegional_IndicatorEx $BackRegional_IndicatorEx; |
| 233 | 237 |
| 234 # special handling for CJK characters: chain for later dictionary segmentation | |
| 235 $HangulSyllable $HangulSyllable; | |
| 236 $KanaKanji $KanaKanji; #different rule status if both kanji and kana found | |
| 237 | |
| 238 ## ------------------------------------------------- | 238 ## ------------------------------------------------- |
| 239 | 239 |
| 240 !!safe_reverse; | 240 !!safe_reverse; |
| 241 | 241 |
| 242 # rule 3 | 242 # rule 3 |
| 243 ($Extend | $Format)+ .?; | 243 ($Extend | $Format)+ .?; |
| 244 | 244 |
| 245 # rule 6 | 245 # rule 6 |
| 246 ($MidLetter | $MidNumLet | $Single_Quote) ($BackALetterEx | $BackHebrew_LetterEx
); | 246 ($MidLetter | $MidNumLet | $Single_Quote) ($BackALetterEx | $BackHebrew_LetterEx
); |
| 247 | 247 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 266 ($MidLetterEx | $MidNumLetEx | $Single_QuoteEx) ($ALetterEx | $Hebrew_LetterEx); | 266 ($MidLetterEx | $MidNumLetEx | $Single_QuoteEx) ($ALetterEx | $Hebrew_LetterEx); |
| 267 | 267 |
| 268 # rule 7b | 268 # rule 7b |
| 269 $Double_QuoteEx $Hebrew_LetterEx; | 269 $Double_QuoteEx $Hebrew_LetterEx; |
| 270 | 270 |
| 271 # rule 11 | 271 # rule 11 |
| 272 ($MidNumEx | $MidNumLetEx | $Single_QuoteEx) $NumericEx; | 272 ($MidNumEx | $MidNumLetEx | $Single_QuoteEx) $NumericEx; |
| 273 | 273 |
| 274 # For dictionary-based break | 274 # For dictionary-based break |
| 275 $dictionary $dictionary; | 275 $dictionary $dictionary; |
| OLD | NEW |