2004-10-21 01:03:01 +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.
|
2004-10-21 01:03:01 +00:00
|
|
|
#
|
|
|
|
# file: word.txt
|
|
|
|
#
|
2005-04-22 21:49:52 +00:00
|
|
|
# ICU Word Break Rules, POSIX locale.
|
2004-10-21 01:03:01 +00:00
|
|
|
# See Unicode Standard Annex #29.
|
2006-08-11 19:37:57 +00:00
|
|
|
# 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
|
2004-10-21 01:03:01 +00:00
|
|
|
#
|
2005-09-10 03:52:54 +00:00
|
|
|
# Note: Updates to word.txt will usually need to be merged into
|
|
|
|
# word_POSIX.txt and word_ja.txt also.
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
##############################################################################
|
|
|
|
#
|
|
|
|
# Character class definitions from TR 29
|
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
!!chain;
|
|
|
|
|
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
#
|
|
|
|
# Character Class Definitions.
|
|
|
|
#
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2006-08-11 19:37:57 +00:00
|
|
|
$VoiceMarks = [\uff9e\uff9f];
|
2005-04-22 21:49:52 +00:00
|
|
|
$Format = [\p{Word_Break = Format}];
|
2006-08-11 19:37:57 +00:00
|
|
|
$Katakana = [\p{Word_Break = Katakana}-$VoiceMarks];
|
2005-04-22 21:49:52 +00:00
|
|
|
$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}];
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
$CR = \u000d;
|
|
|
|
$LF = \u000a;
|
2006-08-11 19:37:57 +00:00
|
|
|
$Extend = [\p{Grapheme_Cluster_Break = Extend}$VoiceMarks];
|
2005-04-22 21:49:52 +00:00
|
|
|
$Control = [\p{Grapheme_Cluster_Break = Control}];
|
2004-10-21 01:03:01 +00:00
|
|
|
|
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)
|
|
|
|
#
|
2006-08-11 19:37:57 +00:00
|
|
|
$KatakanaEx = $Katakana ($Extend | $Format)*;
|
|
|
|
$ALetterEx = $ALetterPlus ($Extend | $Format)*;
|
|
|
|
$MidLetterEx = $MidLetter ($Extend | $Format)*;
|
|
|
|
$MidNumEx = $MidNum ($Extend | $Format)*;
|
|
|
|
$NumericEx = $Numeric ($Extend | $Format)*;
|
|
|
|
$ExtendNumLetEx = $ExtendNumLet ($Extend | $Format)*;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
$Hiragana = [:Hiragana:];
|
|
|
|
$Ideographic = [:IDEOGRAPHIC:];
|
2006-08-11 19:37:57 +00:00
|
|
|
$HiraganaEx = $Hiragana ($Extend | $Format)*;
|
|
|
|
$IdeographicEx = $Ideographic ($Extend | $Format)*;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!forward;
|
|
|
|
|
|
|
|
|
2006-08-11 19:37:57 +00:00
|
|
|
# Rule 3 - CR x LF
|
2005-04-22 21:49:52 +00:00
|
|
|
# see character breaks.
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2006-08-11 19:37:57 +00:00
|
|
|
$CR $LF ($Extend | $Format)*;
|
2005-09-10 03:52:54 +00:00
|
|
|
|
2006-08-11 19:37:57 +00:00
|
|
|
# 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
|
2005-09-10 03:52:54 +00:00
|
|
|
# char that is not in any of the listed word break categories followed by
|
|
|
|
# format char(s).
|
2006-08-11 19:37:57 +00:00
|
|
|
.? ($Extend | $Format)+;
|
2005-09-10 03:52:54 +00:00
|
|
|
|
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
$NumericEx {100};
|
|
|
|
$ALetterEx {200};
|
|
|
|
$KatakanaEx {300};
|
|
|
|
$HiraganaEx {300};
|
|
|
|
$IdeographicEx {400};
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 5
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$ALetterEx $ALetterEx {200};
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 6 and 7
|
2005-09-10 03:52:54 +00:00
|
|
|
$ALetterEx $MidLetterEx $ALetterEx {200};
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 8
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$NumericEx $NumericEx {100};
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 9
|
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
$ALetterEx $Format* $NumericEx {200};
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 10
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$NumericEx $ALetterEx {200};
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 11 and 12
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$NumericEx $MidNumEx $NumericEx {100};
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 13
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$KatakanaEx $KatakanaEx {300};
|
2005-04-22 21:49:52 +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-04-22 21:49:52 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$ExtendNumLetEx $ALetterEx {200}; # (13b)
|
|
|
|
$ExtendNumLetEx $NumericEx {100}; # (13b)
|
|
|
|
$ExtendNumLetEx $KatakanaEx {300}; # (13b)
|
2005-04-22 21:49:52 +00:00
|
|
|
|
|
|
|
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!reverse;
|
|
|
|
|
2006-08-11 19:37:57 +00:00
|
|
|
$BackALetterEx = ($Format | $Extend)* $ALetterPlus;
|
|
|
|
$BackNumericEx = ($Format | $Extend)* $Numeric;
|
|
|
|
$BackMidNumEx = ($Format | $Extend)* $MidNum;
|
|
|
|
$BackMidLetterEx = ($Format | $Extend)* $MidLetter;
|
|
|
|
$BackKatakanaEx = ($Format | $Extend)* $Katakana;
|
|
|
|
$BackExtendNumLetEx= ($Format | $Extend)* $ExtendNumLet;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2006-08-11 19:37:57 +00:00
|
|
|
# rule 3
|
|
|
|
($Format | $Extend)* $LF $CR;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2006-08-11 19:37:57 +00:00
|
|
|
# rule 4
|
|
|
|
($Format | $Extend)* .?;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 5
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackALetterEx $BackALetterEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 6 and 7
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackALetterEx $BackMidLetterEx $BackALetterEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
|
|
|
|
# rule 8
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackNumericEx $BackNumericEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
# rule 9
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackNumericEx $BackALetterEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 10
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackALetterEx $BackNumericEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 11 and 12
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackNumericEx $BackMidNumEx $BackNumericEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 13
|
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
$BackKatakanaEx $BackKatakanaEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
# rules 13 a/b
|
|
|
|
#
|
2005-09-10 03:52:54 +00:00
|
|
|
($BackALetterEx | $BackNumericEx | $BackKatakanaEx | $BackExtendNumLetEx) $BackExtendNumLetEx;
|
|
|
|
$BackExtendNumLetEx ($BackALetterEx | $BackNumericEx | $BackKatakanaEx);
|
2005-04-22 21:49:52 +00:00
|
|
|
|
2004-10-21 01:03:01 +00:00
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!safe_reverse;
|
|
|
|
|
|
|
|
# rule 3
|
2006-08-11 19:37:57 +00:00
|
|
|
($Extend | $Format)+ .?;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 6
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidLetter $BackALetterEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 11
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidNum $BackNumericEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2006-03-23 00:54:12 +00:00
|
|
|
# For dictionary-based break
|
|
|
|
$dictionary $dictionary;
|
|
|
|
|
2004-10-21 01:03:01 +00:00
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!safe_forward;
|
|
|
|
|
|
|
|
# rule 4
|
2006-08-11 19:37:57 +00:00
|
|
|
($Extend | $Format)+ .?;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 6
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidLetterEx $ALetterEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 11
|
2005-09-10 03:52:54 +00:00
|
|
|
$MidNumEx $NumericEx;
|
2005-04-22 21:49:52 +00:00
|
|
|
|
2006-03-23 00:54:12 +00:00
|
|
|
# For dictionary-based break
|
|
|
|
$dictionary $dictionary;
|