]>
Commit | Line | Data |
---|---|---|
1 | # | |
2 | # Copyright (C) 2016 and later: Unicode, Inc. and others. | |
3 | # License & terms of use: http://www.unicode.org/copyright.html | |
4 | # Copyright (C) 2002-2016, International Business Machines Corporation | |
5 | # and others. All Rights Reserved. | |
6 | # | |
7 | # file: word_fi_sv.txt | |
8 | # | |
9 | # ICU Word Break Rules, fi/sv locales (these are actually the standard UAX #29 rules) | |
10 | # See Unicode Standard Annex #29. | |
11 | # These rules are based on UAX #29 Revision 34 for Unicode Version 12.0 | |
12 | # | |
13 | # Note: Updates to word.txt will usually need to be merged into | |
14 | # word_POSIX.txt also. | |
15 | ||
16 | ############################################################################## | |
17 | # | |
18 | # Character class definitions from TR 29 | |
19 | # | |
20 | ############################################################################## | |
21 | ||
22 | !!chain; | |
23 | !!quoted_literals_only; | |
24 | ||
25 | ||
26 | # | |
27 | # Character Class Definitions. | |
28 | # | |
29 | ||
30 | $CR = [\p{Word_Break = CR}]; | |
31 | $LF = [\p{Word_Break = LF}]; | |
32 | $Newline = [\p{Word_Break = Newline} ]; | |
33 | $Extend = [\p{Word_Break = Extend}]; | |
34 | $ZWJ = [\p{Word_Break = ZWJ}]; | |
35 | $Regional_Indicator = [\p{Word_Break = Regional_Indicator}]; | |
36 | $Format = [\p{Word_Break = Format}]; | |
37 | $Katakana = [\p{Word_Break = Katakana}]; | |
38 | $Hebrew_Letter = [\p{Word_Break = Hebrew_Letter}]; | |
39 | $ALetter = [\p{Word_Break = ALetter}]; | |
40 | $Single_Quote = [\p{Word_Break = Single_Quote}]; | |
41 | $Double_Quote = [\p{Word_Break = Double_Quote}]; | |
42 | $MidNumLet = [\p{Word_Break = MidNumLet}]; | |
43 | $MidLetter = [\p{Word_Break = MidLetter}]; | |
44 | $MidNum = [\p{Word_Break = MidNum}]; | |
45 | $Numeric = [[\p{Word_Break = Numeric}] [\uFF10-\uff19]]; # Patch for ICU-12079 | |
46 | $ExtendNumLet = [\p{Word_Break = ExtendNumLet}]; | |
47 | $WSegSpace = [\p{Word_Break = WSegSpace}]; | |
48 | $Extended_Pict = [:ExtPict:]; | |
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 | $ZWJ)*; | |
76 | $Hebrew_LetterEx = $Hebrew_Letter ($Extend | $Format | $ZWJ)*; | |
77 | $ALetterEx = $ALetterPlus ($Extend | $Format | $ZWJ)*; | |
78 | $Single_QuoteEx = $Single_Quote ($Extend | $Format | $ZWJ)*; | |
79 | $Double_QuoteEx = $Double_Quote ($Extend | $Format | $ZWJ)*; | |
80 | $MidNumLetEx = $MidNumLet ($Extend | $Format | $ZWJ)*; | |
81 | $MidLetterEx = $MidLetter ($Extend | $Format | $ZWJ)*; | |
82 | $MidNumEx = $MidNum ($Extend | $Format | $ZWJ)*; | |
83 | $NumericEx = $Numeric ($Extend | $Format | $ZWJ)*; | |
84 | $ExtendNumLetEx = $ExtendNumLet ($Extend | $Format | $ZWJ)*; | |
85 | $Regional_IndicatorEx = $Regional_Indicator ($Extend | $Format | $ZWJ)*; | |
86 | ||
87 | $Ideographic = [\p{Ideographic}]; | |
88 | $HiraganaEx = $Hiragana ($Extend | $Format | $ZWJ)*; | |
89 | $IdeographicEx = $Ideographic ($Extend | $Format | $ZWJ)*; | |
90 | ||
91 | ## ------------------------------------------------- | |
92 | ||
93 | # Rule 3 - CR x LF | |
94 | # | |
95 | $CR $LF; | |
96 | ||
97 | # Rule 3c ZWJ x (Extended_Pict | EmojiNRK). Precedes WB4, so no intervening Extend chars allowed. | |
98 | # | |
99 | $ZWJ $Extended_Pict; | |
100 | ||
101 | # Rule 3d - Keep horizontal whitespace together. | |
102 | # | |
103 | $WSegSpace $WSegSpace; | |
104 | ||
105 | # Rule 4 - ignore Format and Extend characters, except when they appear at the beginning | |
106 | # of a region of Text. The rule here comes into play when the start of text | |
107 | # begins with a group of Format chars, or with a "word" consisting of a single | |
108 | # char that is not in any of the listed word break categories followed by | |
109 | # format char(s), or is not a CJK dictionary character. | |
110 | [^$CR $LF $Newline]? ($Extend | $Format | $ZWJ)+; | |
111 | ||
112 | $NumericEx {100}; | |
113 | $ALetterEx {200}; | |
114 | $HangulSyllable {200}; | |
115 | $Hebrew_LetterEx{200}; | |
116 | $KatakanaEx {400}; # note: these status values override those from rule 5 | |
117 | $HiraganaEx {400}; # by virtue of being numerically larger. | |
118 | $IdeographicEx {400}; # | |
119 | ||
120 | $Extended_Pict ($Extend | $Format | $ZWJ)*; | |
121 | ||
122 | # | |
123 | # rule 5 | |
124 | # Do not break between most letters. | |
125 | # | |
126 | ($ALetterEx | $Hebrew_LetterEx) ($ALetterEx | $Hebrew_LetterEx) {200}; | |
127 | ||
128 | # rule 6 and 7 | |
129 | ($ALetterEx | $Hebrew_LetterEx) ($MidLetterEx | $MidNumLetEx | $Single_QuoteEx) ($ALetterEx | $Hebrew_LetterEx) {200}; | |
130 | ||
131 | # rule 7a | |
132 | $Hebrew_LetterEx $Single_QuoteEx {200}; | |
133 | ||
134 | # rule 7b and 7c | |
135 | $Hebrew_LetterEx $Double_QuoteEx $Hebrew_LetterEx {200}; | |
136 | ||
137 | # rule 8 | |
138 | ||
139 | $NumericEx $NumericEx {100}; | |
140 | ||
141 | # rule 9 | |
142 | ||
143 | ($ALetterEx | $Hebrew_LetterEx) $NumericEx {200}; | |
144 | ||
145 | # rule 10 | |
146 | ||
147 | $NumericEx ($ALetterEx | $Hebrew_LetterEx) {200}; | |
148 | ||
149 | # rule 11 and 12 | |
150 | ||
151 | $NumericEx ($MidNumEx | $MidNumLetEx | $Single_QuoteEx) $NumericEx {100}; | |
152 | ||
153 | # rule 13 | |
154 | # to be consistent with $KanaKanji $KanaKanhi, changed | |
155 | # from 300 to 400. | |
156 | # See also TestRuleStatus in intltest/rbbiapts.cpp | |
157 | $KatakanaEx $KatakanaEx {400}; | |
158 | ||
159 | # rule 13a/b | |
160 | ||
161 | $ALetterEx $ExtendNumLetEx {200}; # (13a) | |
162 | $Hebrew_LetterEx $ExtendNumLetEx {200}; # (13a) | |
163 | $NumericEx $ExtendNumLetEx {100}; # (13a) | |
164 | $KatakanaEx $ExtendNumLetEx {400}; # (13a) | |
165 | $ExtendNumLetEx $ExtendNumLetEx {200}; # (13a) | |
166 | ||
167 | $ExtendNumLetEx $ALetterEx {200}; # (13b) | |
168 | $ExtendNumLetEx $Hebrew_Letter {200}; # (13b) | |
169 | $ExtendNumLetEx $NumericEx {100}; # (13b) | |
170 | $ExtendNumLetEx $KatakanaEx {400}; # (13b) | |
171 | ||
172 | # rules 15 - 17 | |
173 | # Pairs of Regional Indicators stay together. | |
174 | # With rule chaining disabled by ^, this rule will match exactly two of them. | |
175 | # No other rule begins with a Regional_Indicator, so chaining cannot extend the match. | |
176 | # | |
177 | ^$Regional_IndicatorEx $Regional_IndicatorEx; | |
178 | ||
179 | # special handling for CJK characters: chain for later dictionary segmentation | |
180 | $HangulSyllable $HangulSyllable {200}; | |
181 | $KanaKanji $KanaKanji {400}; # different rule status if both kana and kanji found | |
182 | ||
183 | # Rule 999 | |
184 | # Match a single code point if no other rule applies. | |
185 | .; |