Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / icu / source / data / brkitr / word.txt
1 #
2 # Copyright (C) 2002-2013, International Business Machines Corporation 
3 # and others. All Rights Reserved.
4 #
5 # file:  word.txt
6 #
7 # ICU Word Break Rules
8 #      See Unicode Standard Annex #29.
9 #      These rules are based on UAX #29 Revision 22 for Unicode Version 6.3
10 #
11 # Note:  Updates to word.txt will usually need to be merged into
12 #        word_POSIX.txt also.
13
14 ##############################################################################
15 #
16 #  Character class definitions from TR 29
17 #
18 ##############################################################################
19
20 !!chain;
21
22
23 #
24 #  Character Class Definitions.
25 #
26
27 $CR                 = [\p{Word_Break = CR}];
28 $LF                 = [\p{Word_Break = LF}];
29 $Newline            = [\p{Word_Break = Newline}];
30 $Extend             = [\p{Word_Break = Extend}];
31 $Regional_Indicator = [\p{Word_Break = Regional_Indicator}];
32 $Format             = [\p{Word_Break = Format}];
33 $Katakana           = [\p{Word_Break = Katakana}];
34 $Hebrew_Letter      = [\p{Word_Break = Hebrew_Letter}];
35 $ALetter            = [\p{Word_Break = ALetter}];
36 $Single_Quote       = [\p{Word_Break = Single_Quote}];
37 $Double_Quote       = [\p{Word_Break = Double_Quote}];
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]];
45 $MidLetter          = [\p{Word_Break = MidLetter}];
46 $MidNum       = [\p{Word_Break = MidNum}[\u002E \uFF0E]];
47 $Numeric      = [\p{Word_Break = Numeric}[\uff10-\uff19]]; #includes fullwidth digits
48 $ExtendNumLet       = [\p{Word_Break = ExtendNumLet}];
49
50 $Han                = [:Han:];
51 $Hiragana           = [:Hiragana:];
52
53
54 #   Dictionary character set, for triggering language-based break engines. Currently
55 #   limited to LineBreak=Complex_Context. Note that this set only works in Unicode
56 #   5.0 or later as the definition of Complex_Context was corrected to include all
57 #   characters requiring dictionary break.
58
59 $Control        = [\p{Grapheme_Cluster_Break = Control}]; 
60 $HangulSyllable = [\uac00-\ud7a3];
61 $ComplexContext = [:LineBreak = Complex_Context:];
62 $KanaKanji      = [$Han $Hiragana $Katakana];
63 $dictionaryCJK  = [$KanaKanji $HangulSyllable];
64 $dictionary     = [$ComplexContext $dictionaryCJK];
65
66 # leave CJK scripts out of ALetterPlus
67 $ALetterPlus  = [$ALetter-$dictionaryCJK [$ComplexContext-$Extend-$Control]];
68
69
70 #
71 #  Rules 4    Ignore Format and Extend characters, 
72 #             except when they appear at the beginning of a region of text.
73 #
74 # TODO: check if handling of katakana in dictionary makes rules incorrect/void
75 $KatakanaEx           = $Katakana           ($Extend |  $Format)*;
76 $Hebrew_LetterEx      = $Hebrew_Letter      ($Extend |  $Format)*;
77 $ALetterEx            = $ALetterPlus        ($Extend |  $Format)*;
78 $Single_QuoteEx       = $Single_Quote       ($Extend |  $Format)*;
79 $Double_QuoteEx       = $Double_Quote       ($Extend |  $Format)*;
80 $MidNumLetEx          = $MidNumLet          ($Extend |  $Format)*;
81 $MidLetterEx          = $MidLetter          ($Extend |  $Format)*;
82 $MidNumEx             = $MidNum             ($Extend |  $Format)*;
83 $NumericEx            = $Numeric            ($Extend |  $Format)*;
84 $ExtendNumLetEx       = $ExtendNumLet       ($Extend |  $Format)*;
85 $Regional_IndicatorEx = $Regional_Indicator ($Extend |  $Format)*;
86
87 $Ideographic    = [\p{Ideographic}];
88 $HiraganaEx     = $Hiragana     ($Extend |  $Format)*;
89 $IdeographicEx  = $Ideographic  ($Extend |  $Format)*;
90
91 ## -------------------------------------------------
92
93 !!forward;
94
95
96 # Rule 3 - CR x LF
97 #
98 $CR $LF;
99
100 # Rule 4 - ignore Format and Extend characters, except when they appear at the beginning
101 #          of a region of Text.   The rule here comes into play when the start of text
102 #          begins with a group of Format chars, or with a "word" consisting of a single
103 #          char that is not in any of the listed word break categories followed by
104 #          format char(s), or is not a CJK dictionary character.
105 [^$CR $LF $Newline]? ($Extend |  $Format)+;
106
107 $NumericEx {100};
108 $ALetterEx {200};
109 $HangulSyllable {200};
110 $Hebrew_LetterEx{200};
111 $KatakanaEx {400};       # note:  these status values override those from rule 5
112 $HiraganaEx {400};       #        by virtue of being numerically larger.
113 $IdeographicEx {400};    #
114
115 #
116 # rule 5
117 #    Do not break between most letters.
118 #
119 ($ALetterEx | $Hebrew_LetterEx)  ($ALetterEx | $Hebrew_LetterEx) {200};
120
121 # rule 6 and 7
122 ($ALetterEx | $Hebrew_LetterEx) ($MidLetterEx | $MidNumLetEx | $Single_QuoteEx) ($ALetterEx | $Hebrew_LetterEx) {200};
123
124 # rule 7a
125 $Hebrew_LetterEx $Single_QuoteEx {200};
126
127 # rule 7b and 7c
128 $Hebrew_LetterEx $Double_QuoteEx $Hebrew_LetterEx {200};
129
130 # rule 8
131
132 $NumericEx $NumericEx {100};
133
134 # rule 9
135
136 ($ALetterEx | $Hebrew_LetterEx) $NumericEx {200};
137
138 # rule 10
139
140 $NumericEx ($ALetterEx | $Hebrew_LetterEx) {200};
141
142 # rule 11 and 12 
143
144 $NumericEx ($MidNumEx | $MidNumLetEx | $Single_QuoteEx) $NumericEx {100};
145
146 # rule 13
147 # to be consistent with $KanaKanji $KanaKanhi, changed
148 # from 300 to 400.
149 # See also TestRuleStatus in intltest/rbbiapts.cpp
150 $KatakanaEx  $KatakanaEx {400};
151
152 # rule 13a/b
153
154 $ALetterEx       $ExtendNumLetEx {200};    #  (13a)
155 $Hebrew_LetterEx $ExtendNumLetEx {200};    #  (13a)
156 $NumericEx       $ExtendNumLetEx {100};    #  (13a)
157 $KatakanaEx      $ExtendNumLetEx {400};    #  (13a)
158 $ExtendNumLetEx  $ExtendNumLetEx {200};    #  (13a)
159
160 $ExtendNumLetEx  $ALetterEx      {200};    #  (13b)
161 $ExtendNumLetEx  $Hebrew_Letter  {200};    #  (13b)
162 $ExtendNumLetEx  $NumericEx      {100};    #  (13b)
163 $ExtendNumLetEx  $KatakanaEx     {400};    #  (13b)
164
165 # rule 13c
166
167 $Regional_IndicatorEx $Regional_IndicatorEx;
168
169 # special handling for CJK characters: chain for later dictionary segmentation
170 $HangulSyllable $HangulSyllable {200};
171 $KanaKanji $KanaKanji {400}; # different rule status if both kana and kanji found 
172
173
174 ## -------------------------------------------------
175
176 !!reverse;
177
178 $BackHebrew_LetterEx      = ($Format | $Extend)* $Hebrew_Letter;
179 $BackALetterEx            = ($Format | $Extend)* $ALetterPlus;
180 $BackSingle_QuoteEx       = ($Format | $Extend)* $Single_Quote;
181 $BackDouble_QuoteEx       = ($Format | $Extend)* $Double_Quote;
182 $BackMidNumLetEx          = ($Format | $Extend)* $MidNumLet;
183 $BackNumericEx            = ($Format | $Extend)* $Numeric;
184 $BackMidNumEx             = ($Format | $Extend)* $MidNum;
185 $BackMidLetterEx          = ($Format | $Extend)* $MidLetter;
186 $BackKatakanaEx           = ($Format | $Extend)* $Katakana;
187 $BackHiraganaEx           = ($Format | $Extend)* $Hiragana;
188 $BackExtendNumLetEx       = ($Format | $Extend)* $ExtendNumLet;
189 $BackRegional_IndicatorEx = ($Format | $Extend)* $Regional_Indicator;
190
191 # rule 3
192 $LF $CR;
193
194 # rule 4
195 ($Format | $Extend)*  [^$CR $LF $Newline]?;
196
197 # rule 5
198
199 ($BackALetterEx | $BackHebrew_LetterEx) ($BackALetterEx | $BackHebrew_LetterEx);
200
201 # rule 6 and 7
202
203 ($BackALetterEx | $BackHebrew_LetterEx) ($BackMidLetterEx | $BackMidNumLetEx | $BackSingle_QuoteEx) ($BackALetterEx | $BackHebrew_LetterEx);
204
205 # rule 7a
206 $BackSingle_QuoteEx $BackHebrew_LetterEx;
207
208 # Rule 7b and 7c
209 $BackHebrew_LetterEx $BackDouble_QuoteEx $BackHebrew_LetterEx;
210
211 # rule 8
212
213 $BackNumericEx $BackNumericEx;
214
215 # rule 9
216
217 $BackNumericEx ($BackALetterEx | $BackHebrew_LetterEx);
218
219 # rule 10
220
221 ($BackALetterEx | $BackHebrew_LetterEx) $BackNumericEx;
222
223 # rule 11 and 12
224
225 $BackNumericEx ($BackMidNumEx | $BackMidNumLetEx | $BackSingle_QuoteEx) $BackNumericEx;
226
227 # rule 13
228
229 $BackKatakanaEx $BackKatakanaEx;
230
231 # rules 13 a/b
232 #
233 $BackExtendNumLetEx ($BackALetterEx | $BackHebrew_LetterEx | $BackNumericEx | $BackKatakanaEx | $BackExtendNumLetEx);
234 ($BackALetterEx | $BackHebrew_LetterEx | $BackNumericEx | $BackKatakanaEx) $BackExtendNumLetEx; 
235
236 # rule 13c
237
238 $BackRegional_IndicatorEx $BackRegional_IndicatorEx;
239
240 # special handling for CJK characters: chain for later dictionary segmentation
241 $HangulSyllable $HangulSyllable;
242 $KanaKanji $KanaKanji; #different rule status if both kanji and kana found
243
244 ## -------------------------------------------------
245
246 !!safe_reverse;
247
248 # rule 3
249 ($Extend | $Format)+ .?;
250
251 # rule 6
252 ($MidLetter | $MidNumLet | $Single_Quote) ($BackALetterEx | $BackHebrew_LetterEx);
253
254 # rule 7b
255 $Double_Quote $BackHebrew_LetterEx;
256
257
258 # rule 11
259 ($MidNum | $MidNumLet | $Single_Quote) $BackNumericEx;
260
261 # For dictionary-based break
262 $dictionary $dictionary;
263
264 ## -------------------------------------------------
265
266 !!safe_forward;
267
268 # rule 4
269 ($Extend | $Format)+ .?;
270
271 # rule 6
272 ($MidLetterEx | $MidNumLetEx | $Single_QuoteEx) ($ALetterEx | $Hebrew_LetterEx);
273
274 # rule 7b
275 $Double_QuoteEx $Hebrew_LetterEx;
276
277 # rule 11
278 ($MidNumEx | $MidNumLetEx | $Single_QuoteEx) $NumericEx;
279
280 # For dictionary-based break
281 $dictionary $dictionary;