]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | # |
2 | # Copyright (C) 2016 and later: Unicode, Inc. and others. | |
3 | # License & terms of use: http://www.unicode.org/copyright.html | |
0f5d89e8 | 4 | # Copyright (C) 2002-2016, International Business Machines Corporation |
374ca955 | 5 | # and others. All Rights Reserved. |
b75a7d8f | 6 | # |
2ca993e8 | 7 | # file: word_fi_sv.txt |
b75a7d8f | 8 | # |
2ca993e8 | 9 | # ICU Word Break Rules, fi/sv locales (these are actually the standard UAX #29 rules) |
b75a7d8f | 10 | # See Unicode Standard Annex #29. |
3d1f044b | 11 | # These rules are based on UAX #29 Revision 34 for Unicode Version 12.0 |
b75a7d8f | 12 | # |
73c04bcf | 13 | # Note: Updates to word.txt will usually need to be merged into |
51004dcb | 14 | # word_POSIX.txt also. |
b75a7d8f | 15 | |
374ca955 | 16 | ############################################################################## |
b75a7d8f A |
17 | # |
18 | # Character class definitions from TR 29 | |
19 | # | |
374ca955 A |
20 | ############################################################################## |
21 | ||
22 | !!chain; | |
0f5d89e8 | 23 | !!quoted_literals_only; |
374ca955 | 24 | |
b75a7d8f A |
25 | |
26 | # | |
27 | # Character Class Definitions. | |
b75a7d8f | 28 | # |
b75a7d8f | 29 | |
57a6839d A |
30 | $CR = [\p{Word_Break = CR}]; |
31 | $LF = [\p{Word_Break = LF}]; | |
2ca993e8 | 32 | $Newline = [\p{Word_Break = Newline} ]; |
f3c0d7a5 A |
33 | $Extend = [\p{Word_Break = Extend}]; |
34 | $ZWJ = [\p{Word_Break = ZWJ}]; | |
2ca993e8 | 35 | $Regional_Indicator = [\p{Word_Break = Regional_Indicator}]; |
f3c0d7a5 | 36 | $Format = [\p{Word_Break = Format}]; |
57a6839d A |
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}]; | |
3d1f044b | 45 | $Numeric = [[\p{Word_Break = Numeric}] [\uFF10-\uff19]]; # Patch for ICU-12079 |
57a6839d | 46 | $ExtendNumLet = [\p{Word_Break = ExtendNumLet}]; |
0f5d89e8 A |
47 | $WSegSpace = [\p{Word_Break = WSegSpace}]; |
48 | $Extended_Pict = [:ExtPict:]; | |
57a6839d A |
49 | |
50 | $Han = [:Han:]; | |
51 | $Hiragana = [:Hiragana:]; | |
73c04bcf A |
52 | |
53 | ||
73c04bcf A |
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 | ||
3d1f044b | 59 | $Control = [\p{Grapheme_Cluster_Break = Control}]; |
51004dcb A |
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 | ||
73c04bcf A |
69 | |
70 | # | |
3d1f044b | 71 | # Rules 4 Ignore Format and Extend characters, |
46f4442e | 72 | # except when they appear at the beginning of a region of text. |
73c04bcf | 73 | # |
51004dcb | 74 | # TODO: check if handling of katakana in dictionary makes rules incorrect/void |
2ca993e8 A |
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)*; | |
73c04bcf | 86 | |
46f4442e | 87 | $Ideographic = [\p{Ideographic}]; |
2ca993e8 A |
88 | $HiraganaEx = $Hiragana ($Extend | $Format | $ZWJ)*; |
89 | $IdeographicEx = $Ideographic ($Extend | $Format | $ZWJ)*; | |
b75a7d8f | 90 | |
374ca955 | 91 | ## ------------------------------------------------- |
b75a7d8f | 92 | |
73c04bcf | 93 | # Rule 3 - CR x LF |
46f4442e A |
94 | # |
95 | $CR $LF; | |
73c04bcf | 96 | |
f3c0d7a5 | 97 | # Rule 3c ZWJ x (Extended_Pict | EmojiNRK). Precedes WB4, so no intervening Extend chars allowed. |
2ca993e8 | 98 | # |
0f5d89e8 | 99 | $ZWJ $Extended_Pict; |
2ca993e8 | 100 | |
0f5d89e8 A |
101 | # Rule 3d - Keep horizontal whitespace together. |
102 | # | |
103 | $WSegSpace $WSegSpace; | |
2ca993e8 | 104 | |
73c04bcf A |
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 | |
51004dcb | 109 | # format char(s), or is not a CJK dictionary character. |
2ca993e8 | 110 | [^$CR $LF $Newline]? ($Extend | $Format | $ZWJ)+; |
b75a7d8f | 111 | |
374ca955 A |
112 | $NumericEx {100}; |
113 | $ALetterEx {200}; | |
51004dcb | 114 | $HangulSyllable {200}; |
57a6839d | 115 | $Hebrew_LetterEx{200}; |
51004dcb A |
116 | $KatakanaEx {400}; # note: these status values override those from rule 5 |
117 | $HiraganaEx {400}; # by virtue of being numerically larger. | |
46f4442e | 118 | $IdeographicEx {400}; # |
b75a7d8f | 119 | |
f3c0d7a5 | 120 | $Extended_Pict ($Extend | $Format | $ZWJ)*; |
2ca993e8 | 121 | |
46f4442e | 122 | # |
374ca955 | 123 | # rule 5 |
46f4442e A |
124 | # Do not break between most letters. |
125 | # | |
57a6839d | 126 | ($ALetterEx | $Hebrew_LetterEx) ($ALetterEx | $Hebrew_LetterEx) {200}; |
b75a7d8f | 127 | |
374ca955 | 128 | # rule 6 and 7 |
57a6839d A |
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}; | |
b75a7d8f | 136 | |
374ca955 | 137 | # rule 8 |
b75a7d8f | 138 | |
73c04bcf | 139 | $NumericEx $NumericEx {100}; |
b75a7d8f | 140 | |
374ca955 | 141 | # rule 9 |
b75a7d8f | 142 | |
57a6839d | 143 | ($ALetterEx | $Hebrew_LetterEx) $NumericEx {200}; |
b75a7d8f | 144 | |
374ca955 | 145 | # rule 10 |
b75a7d8f | 146 | |
57a6839d | 147 | $NumericEx ($ALetterEx | $Hebrew_LetterEx) {200}; |
b75a7d8f | 148 | |
3d1f044b | 149 | # rule 11 and 12 |
374ca955 | 150 | |
57a6839d | 151 | $NumericEx ($MidNumEx | $MidNumLetEx | $Single_QuoteEx) $NumericEx {100}; |
374ca955 A |
152 | |
153 | # rule 13 | |
51004dcb A |
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}; | |
374ca955 A |
158 | |
159 | # rule 13a/b | |
160 | ||
57a6839d A |
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) | |
374ca955 | 166 | |
57a6839d A |
167 | $ExtendNumLetEx $ALetterEx {200}; # (13b) |
168 | $ExtendNumLetEx $Hebrew_Letter {200}; # (13b) | |
169 | $ExtendNumLetEx $NumericEx {100}; # (13b) | |
170 | $ExtendNumLetEx $KatakanaEx {400}; # (13b) | |
51004dcb | 171 | |
f3c0d7a5 | 172 | # rules 15 - 17 |
2ca993e8 A |
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; | |
51004dcb A |
178 | |
179 | # special handling for CJK characters: chain for later dictionary segmentation | |
180 | $HangulSyllable $HangulSyllable {200}; | |
3d1f044b | 181 | $KanaKanji $KanaKanji {400}; # different rule status if both kana and kanji found |
374ca955 | 182 | |
0f5d89e8 A |
183 | # Rule 999 |
184 | # Match a single code point if no other rule applies. | |
185 | .; |