2002-06-25 17:23:07 +00:00
|
|
|
#
|
2006-03-23 00:54:12 +00:00
|
|
|
# Copyright (C) 2002-2006, International Business Machines Corporation
|
2004-11-01 23:54:44 +00:00
|
|
|
# and others. All Rights Reserved.
|
2002-08-09 03:14:43 +00:00
|
|
|
#
|
2003-11-25 00:23:46 +00:00
|
|
|
# file: word.txt
|
2002-08-09 03:14:43 +00:00
|
|
|
#
|
2003-11-05 23:50:39 +00:00
|
|
|
# ICU Word Break Rules
|
2003-04-08 05:35:13 +00:00
|
|
|
# See Unicode Standard Annex #29.
|
2005-04-22 21:49:52 +00:00
|
|
|
# These rules are based on Unicode Version 4.1
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2005-04-22 21:49:52 +00:00
|
|
|
# Note: Updates to word.txt will usually need to be merged into
|
|
|
|
# word_POSIX.txt and word_ja.txt also.
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
##############################################################################
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2003-04-08 05:35:13 +00:00
|
|
|
# Character class definitions from TR 29
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2003-11-05 23:50:39 +00:00
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
!!chain;
|
|
|
|
|
2003-04-08 05:35:13 +00:00
|
|
|
|
2002-07-22 22:02:08 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
# Character Class Definitions.
|
|
|
|
#
|
|
|
|
|
2005-03-23 02:13:53 +00:00
|
|
|
$Format = [\p{Word_Break = Format}];
|
|
|
|
$Katakana = [\p{Word_Break = Katakana}];
|
|
|
|
$ALetter = [\p{Word_Break = ALetter}];
|
|
|
|
$MidLetter = [\p{Word_Break = MidLetter}];
|
|
|
|
$MidNum = [\p{Word_Break = MidNum}];
|
|
|
|
$Numeric = [\p{Word_Break = Numeric}];
|
2005-04-22 21:49:52 +00:00
|
|
|
$ExtendNumLet = [\p{Word_Break = ExtendNumLet}];
|
2005-03-23 02:13:53 +00:00
|
|
|
|
|
|
|
|
2005-01-11 00:49:22 +00:00
|
|
|
$CR = \u000d;
|
|
|
|
$LF = \u000a;
|
2005-03-23 02:13:53 +00:00
|
|
|
$Extend = [\p{Grapheme_Cluster_Break = Extend}];
|
|
|
|
$Control = [\p{Grapheme_Cluster_Break = Control}];
|
|
|
|
|
2006-03-23 00:54:12 +00:00
|
|
|
# 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]];
|
|
|
|
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
#
|
|
|
|
# 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*;
|
2006-03-23 00:54:12 +00:00
|
|
|
$ALetterEx = $ALetterPlus $Extend* $Format*;
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidLetterEx = $MidLetter $Extend* $Format*;
|
|
|
|
$MidNumEx = $MidNum $Extend* $Format*;
|
|
|
|
$NumericEx = $Numeric $Extend* $Format*;
|
|
|
|
$ExtendNumLetEx = $ExtendNumLet $Extend* $Format*;
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
$Hiragana = [:Hiragana:];
|
|
|
|
$Ideographic = [:IDEOGRAPHIC:];
|
2005-09-10 03:52:54 +00:00
|
|
|
$HiraganaEx = $Hiragana $Extend* $Format*;
|
|
|
|
$IdeographicEx = $Ideographic $Extend* $Format*;
|
2005-04-22 21:49:52 +00:00
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!forward;
|
|
|
|
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2005-01-11 00:49:22 +00:00
|
|
|
# Rule 3 - don't break grapheme clusters.
|
2005-03-23 02:13:53 +00:00
|
|
|
# see character breaks.
|
2003-11-11 05:00:08 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$CR $LF $Format*;
|
|
|
|
[^$Control $CR $LF] $Extend+ $Format*;
|
|
|
|
[^$Control $CR $LF] $Extend* $Format+;
|
|
|
|
|
|
|
|
# Rule 4 - ignore trailing format characters
|
|
|
|
# For the most part, trailing formats are handled by the $<whatever>Ex
|
|
|
|
# definitions above. The rule here comes into play when the start of text
|
|
|
|
# begins with a group of Format chars, or with "word" consisting of a single
|
|
|
|
# char that is not in any of the listed word break categories followed by
|
|
|
|
# format char(s).
|
|
|
|
.? $Format+;
|
|
|
|
|
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
$NumericEx {100};
|
|
|
|
$ALetterEx {200};
|
|
|
|
$KatakanaEx {300};
|
|
|
|
$HiraganaEx {300};
|
|
|
|
$IdeographicEx {400};
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
# rule 5
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$ALetterEx $ALetterEx {200};
|
2002-07-22 22:02:08 +00:00
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
# rule 6 and 7
|
2005-09-10 03:52:54 +00:00
|
|
|
$ALetterEx $MidLetterEx $ALetterEx {200};
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 8
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$NumericEx $NumericEx {100};
|
2003-11-05 23:50:39 +00:00
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
# rule 9
|
|
|
|
|
2005-01-11 00:49:22 +00:00
|
|
|
$ALetterEx $Format* $NumericEx {200};
|
2003-11-07 00:04:13 +00:00
|
|
|
|
|
|
|
# rule 10
|
2003-11-05 23:50:39 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$NumericEx $ALetterEx {200};
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 11 and 12
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$NumericEx $MidNumEx $NumericEx {100};
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 13
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$KatakanaEx $KatakanaEx {300};
|
2005-03-23 02:13:53 +00:00
|
|
|
|
2005-01-11 00:49:22 +00:00
|
|
|
# rule 13a/b
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$ALetterEx $ExtendNumLetEx {200}; # (13a)
|
|
|
|
$NumericEx $ExtendNumLetEx {100}; # (13a)
|
|
|
|
$KatakanaEx $ExtendNumLetEx {300}; # (13a)
|
|
|
|
$ExtendNumLetEx $ExtendNumLetEx{200}; # (13a)
|
2005-01-11 00:49:22 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$ExtendNumLetEx $ALetterEx {200}; # (13b)
|
|
|
|
$ExtendNumLetEx $NumericEx {100}; # (13b)
|
|
|
|
$ExtendNumLetEx $KatakanaEx {300}; # (13b)
|
2005-01-11 00:49:22 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
## -------------------------------------------------
|
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
!!reverse;
|
2002-07-24 19:10:18 +00:00
|
|
|
|
2006-03-23 00:54:12 +00:00
|
|
|
$BackALetterEx = $Format* $Extend* $ALetterPlus;
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackNumericEx = $Format* $Extend* $Numeric;
|
|
|
|
$BackMidNumEx = $Format* $Extend* $MidNum;
|
|
|
|
$BackMidLetterEx = $Format* $Extend* $MidLetter;
|
|
|
|
$BackKatakanaEx = $Format* $Extend* $Katakana;
|
|
|
|
$BackExtendNumLetEx= $Format* $Extend* $ExtendNumLet;
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$Format* $LF $CR;
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
# see character breaks
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$Format* $Extend* [^$Control $CR $LF];
|
|
|
|
$Format+ .?;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 5
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackALetterEx $BackALetterEx;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 6 and 7
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackALetterEx $BackMidLetterEx $BackALetterEx;
|
2004-10-25 23:50:11 +00:00
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 8
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackNumericEx $BackNumericEx;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
2005-01-11 00:49:22 +00:00
|
|
|
# rule 9
|
2004-10-25 23:50:11 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackNumericEx $BackALetterEx;
|
2003-11-11 05:00:08 +00:00
|
|
|
|
|
|
|
# rule 10
|
2003-11-05 23:50:39 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackALetterEx $BackNumericEx;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 11 and 12
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackNumericEx $BackMidNumEx $BackNumericEx;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 13
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackKatakanaEx $BackKatakanaEx;
|
2003-11-07 00:04:13 +00:00
|
|
|
|
2005-01-11 00:49:22 +00:00
|
|
|
# rules 13 a/b
|
|
|
|
#
|
2005-09-10 03:52:54 +00:00
|
|
|
($BackALetterEx | $BackNumericEx | $BackKatakanaEx | $BackExtendNumLetEx) $BackExtendNumLetEx;
|
|
|
|
$BackExtendNumLetEx ($BackALetterEx | $BackNumericEx | $BackKatakanaEx);
|
2005-01-11 00:49:22 +00:00
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!safe_reverse;
|
|
|
|
|
2003-11-09 06:52:44 +00:00
|
|
|
# rule 3
|
|
|
|
$Extend+ [^$Extend];
|
2005-09-10 03:52:54 +00:00
|
|
|
$Format+ $Extend* [^$Extend];
|
2004-05-17 02:49:46 +00:00
|
|
|
$Extend+; # comes into play when buffer _begins_ with an $Extend+.
|
2005-09-10 03:52:54 +00:00
|
|
|
$Format+;
|
2003-11-09 06:52:44 +00:00
|
|
|
|
2004-05-17 02:49:46 +00:00
|
|
|
|
2003-11-09 06:52:44 +00:00
|
|
|
# rule 6
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidLetter $BackALetterEx;
|
2003-11-09 06:52:44 +00:00
|
|
|
|
|
|
|
# rule 11
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidNum $BackNumericEx;
|
2003-11-09 06:52:44 +00:00
|
|
|
|
2006-03-23 00:54:12 +00:00
|
|
|
# For dictionary-based break
|
|
|
|
$dictionary $dictionary;
|
|
|
|
|
2003-11-09 06:52:44 +00:00
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!safe_forward;
|
|
|
|
|
|
|
|
# rule 3
|
2005-09-10 03:52:54 +00:00
|
|
|
$Extend+ $Format*;
|
2003-11-09 06:52:44 +00:00
|
|
|
|
|
|
|
# rule 4
|
2004-05-17 23:16:00 +00:00
|
|
|
$Extend* $Format+ $ALetterEx;
|
|
|
|
$Extend* $Format+ $NumericEx;
|
|
|
|
$Extend* $Format+ $MidLetterEx;
|
|
|
|
$Extend* $Format+ $MidNumEx;
|
|
|
|
$Extend* $Format+ $KatakanaEx;
|
2005-01-11 00:49:22 +00:00
|
|
|
$Extend* $Format+ $ExtendNumLetEx;
|
2004-05-17 23:16:00 +00:00
|
|
|
|
|
|
|
$Extend+ $Format* $ALetterEx;
|
|
|
|
$Extend+ $Format* $NumericEx;
|
|
|
|
$Extend+ $Format* $MidLetterEx;
|
|
|
|
$Extend+ $Format* $MidNumEx;
|
|
|
|
$Extend+ $Format* $KatakanaEx;
|
2005-01-11 00:49:22 +00:00
|
|
|
$Extend+ $Format* $ExtendNumLetEx;
|
2003-11-09 06:52:44 +00:00
|
|
|
|
|
|
|
# rule 6
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidLetterEx $ALetterEx;
|
2003-11-09 06:52:44 +00:00
|
|
|
|
|
|
|
# rule 11
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidNumEx $NumericEx;
|
2005-01-11 00:49:22 +00:00
|
|
|
|
2006-03-23 00:54:12 +00:00
|
|
|
# For dictionary-based break
|
|
|
|
$dictionary $dictionary;
|