summaryrefslogtreecommitdiff
path: root/Build/source/libs/icu-xetex/data/brkitr/word.txt
blob: 7257f94a99fce747b5b727385249d6f4844a20db (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
#
# Copyright (C) 2002-2006, International Business Machines Corporation 
# and others. All Rights Reserved.
#
# file:  word.txt
#
# ICU Word Break Rules
#      See Unicode Standard Annex #29.
#      These rules are based on Unicode Version 5.0 0
#        Includes post Unicode 5.0 change to treat Japanese half width voicing marks
#        as Extend
#
# Note:  Updates to word.txt will usually need to be merged into
#        word_POSIX.txt and word_ja.txt also.

##############################################################################
#
#  Character class definitions from TR 29
#
##############################################################################

!!chain;


#
#  Character Class Definitions.
#

$VoiceMarks   = [\uff9e\uff9f];
$Format       = [\p{Word_Break = Format}];
$Katakana     = [\p{Word_Break = Katakana}-$VoiceMarks];
$ALetter      = [\p{Word_Break = ALetter}];
$MidLetter    = [\p{Word_Break = MidLetter}];
$MidNum       = [\p{Word_Break = MidNum}];
$Numeric      = [\p{Word_Break = Numeric}];
$ExtendNumLet = [\p{Word_Break = ExtendNumLet}];


$CR             = \u000d;
$LF             = \u000a;
$Extend         = [\p{Grapheme_Cluster_Break = Extend}$VoiceMarks];
$Control        = [\p{Grapheme_Cluster_Break = Control}];

#   Dictionary character set, for triggering language-based break engines. Currently
#   limited to LineBreak=Complex_Context. Note that this set only works in Unicode
#   5.0 or later as the definition of Complex_Context was corrected to include all
#   characters requiring dictionary break.

$dictionary   = [:LineBreak = Complex_Context:];
$ALetterPlus  = [$ALetter [$dictionary-$Extend-$Control]];


#
#  Rules 3    Grapheme Clusters behave like their first char.
#  Rule  4    Ignore trailing Format characters  (Also see note in TR 29)
#
$KatakanaEx     = $Katakana     ($Extend |  $Format)*;
$ALetterEx      = $ALetterPlus  ($Extend |  $Format)*;
$MidLetterEx    = $MidLetter    ($Extend |  $Format)*;
$MidNumEx       = $MidNum       ($Extend |  $Format)*;
$NumericEx      = $Numeric      ($Extend |  $Format)*;
$ExtendNumLetEx = $ExtendNumLet ($Extend |  $Format)*;

$Hiragana       = [:Hiragana:];
$Ideographic    = [:IDEOGRAPHIC:];
$HiraganaEx     = $Hiragana     ($Extend |  $Format)*;
$IdeographicEx  = $Ideographic  ($Extend |  $Format)*;

## -------------------------------------------------

!!forward;


# Rule 3 - CR x LF
#          see character breaks.

$CR $LF  ($Extend | $Format)*;

# Rule 4 - ignore Format and Extend characters, except when they appear at the beginning
#          of a region of Text.   The rule here comes into play when the start of text
#          begins with a group of Format chars, or with a "word" consisting of a single
#          char that is not in any of the listed word break categories followed by
#          format char(s).
.? ($Extend |  $Format)+;


$NumericEx {100};
$ALetterEx {200};
$KatakanaEx {300};
$HiraganaEx {300};
$IdeographicEx {400};

# rule 5

$ALetterEx $ALetterEx {200};

# rule 6 and 7
$ALetterEx $MidLetterEx $ALetterEx {200};

# rule 8

$NumericEx $NumericEx {100};

# rule 9

$ALetterEx $Format* $NumericEx {200};

# rule 10

$NumericEx $ALetterEx {200};

# rule 11 and 12 

$NumericEx $MidNumEx $NumericEx {100};

# rule 13

$KatakanaEx  $KatakanaEx {300};

# rule 13a/b

$ALetterEx      $ExtendNumLetEx {200};    #  (13a)
$NumericEx      $ExtendNumLetEx {100};    #  (13a)
$KatakanaEx     $ExtendNumLetEx {300};    #  (13a)
$ExtendNumLetEx $ExtendNumLetEx{200}; #  (13a)

$ExtendNumLetEx $ALetterEx  {200};    #  (13b)
$ExtendNumLetEx $NumericEx  {100};    #  (13b)
$ExtendNumLetEx $KatakanaEx {300};    #  (13b)
 


## -------------------------------------------------

!!reverse;

$BackALetterEx     = ($Format | $Extend)* $ALetterPlus;
$BackNumericEx     = ($Format | $Extend)* $Numeric;
$BackMidNumEx      = ($Format | $Extend)* $MidNum;
$BackMidLetterEx   = ($Format | $Extend)* $MidLetter;
$BackKatakanaEx    = ($Format | $Extend)* $Katakana;
$BackExtendNumLetEx= ($Format | $Extend)* $ExtendNumLet;

# rule 3
($Format | $Extend)* $LF $CR;

# rule 4
($Format | $Extend)*  .?;

# rule 5

$BackALetterEx $BackALetterEx;

# rule 6 and 7

$BackALetterEx $BackMidLetterEx $BackALetterEx;


# rule 8

$BackNumericEx $BackNumericEx;

# rule 9

$BackNumericEx $BackALetterEx;

# rule 10

$BackALetterEx $BackNumericEx;

# rule 11 and 12

$BackNumericEx $BackMidNumEx $BackNumericEx;

# rule 13

$BackKatakanaEx $BackKatakanaEx;

# rules 13 a/b
#
($BackALetterEx | $BackNumericEx | $BackKatakanaEx | $BackExtendNumLetEx) $BackExtendNumLetEx; 
$BackExtendNumLetEx ($BackALetterEx | $BackNumericEx | $BackKatakanaEx);

## -------------------------------------------------

!!safe_reverse;

# rule 3
($Extend | $Format)+ .?;

# rule 6
$MidLetter $BackALetterEx;

# rule 11
$MidNum $BackNumericEx;

# For dictionary-based break
$dictionary $dictionary;

## -------------------------------------------------

!!safe_forward;

# rule 4
($Extend | $Format)+ .?;

# rule 6
$MidLetterEx $ALetterEx;

# rule 11
$MidNumEx $NumericEx;

# For dictionary-based break
$dictionary $dictionary;