2004-10-21 01:03:01 +00:00
|
|
|
#
|
2010-09-18 01:22:35 +00:00
|
|
|
# Copyright (C) 2002-2010, 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
|
|
|
#
|
2008-04-04 22:47:43 +00:00
|
|
|
# file: word_POSIX.txt
|
2004-10-21 01:03:01 +00:00
|
|
|
#
|
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.
|
2010-09-18 01:22:35 +00:00
|
|
|
# These rules are based on UAX-29 Revision 16 for Unicode 6.0
|
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
|
|
|
|
2008-04-04 22:47:43 +00:00
|
|
|
$CR = [\p{Word_Break = CR}];
|
|
|
|
$LF = [\p{Word_Break = LF}];
|
|
|
|
$Newline = [\p{Word_Break = Newline}];
|
|
|
|
$Extend = [\p{Word_Break = Extend}];
|
2005-04-22 21:49:52 +00:00
|
|
|
$Format = [\p{Word_Break = Format}];
|
2008-04-04 22:47:43 +00:00
|
|
|
$Katakana = [\p{Word_Break = Katakana}];
|
2005-04-22 21:49:52 +00:00
|
|
|
$ALetter = [\p{Word_Break = ALetter}];
|
2009-04-21 22:42:37 +00:00
|
|
|
$MidNumLet = [\p{Word_Break = MidNumLet} - [.]];
|
|
|
|
$MidLetter = [\p{Word_Break = MidLetter} - [\:]];
|
|
|
|
$MidNum = [\p{Word_Break = MidNum} [.]];
|
2005-04-22 21:49:52 +00:00
|
|
|
$Numeric = [\p{Word_Break = Numeric}];
|
|
|
|
$ExtendNumLet = [\p{Word_Break = ExtendNumLet}];
|
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:];
|
2008-04-04 22:47:43 +00:00
|
|
|
$Control = [\p{Grapheme_Cluster_Break = Control}];
|
|
|
|
$ALetterPlus = [$ALetter [$dictionary-$Extend-$Control]]; # Note: default ALetter does not
|
|
|
|
# include the dictionary characters.
|
2006-03-23 00:54:12 +00:00
|
|
|
|
2005-09-10 03:52:54 +00:00
|
|
|
#
|
2008-04-04 22:47:43 +00:00
|
|
|
# Rules 4 Ignore Format and Extend characters,
|
|
|
|
# except when they appear at the beginning of a region of text.
|
2005-09-10 03:52:54 +00:00
|
|
|
#
|
2006-08-11 19:37:57 +00:00
|
|
|
$KatakanaEx = $Katakana ($Extend | $Format)*;
|
|
|
|
$ALetterEx = $ALetterPlus ($Extend | $Format)*;
|
2008-04-04 22:47:43 +00:00
|
|
|
$MidNumLetEx = $MidNumLet ($Extend | $Format)*;
|
2006-08-11 19:37:57 +00:00
|
|
|
$MidLetterEx = $MidLetter ($Extend | $Format)*;
|
|
|
|
$MidNumEx = $MidNum ($Extend | $Format)*;
|
|
|
|
$NumericEx = $Numeric ($Extend | $Format)*;
|
|
|
|
$ExtendNumLetEx = $ExtendNumLet ($Extend | $Format)*;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2008-04-04 22:47:43 +00:00
|
|
|
$Hiragana = [\p{script=Hiragana}];
|
|
|
|
$Ideographic = [\p{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
|
2008-04-04 22:47:43 +00:00
|
|
|
#
|
|
|
|
$CR $LF;
|
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).
|
2008-04-04 22:47:43 +00:00
|
|
|
[^$CR $LF $Newline]? ($Extend | $Format)+;
|
2005-09-10 03:52:54 +00:00
|
|
|
|
2005-04-22 21:49:52 +00:00
|
|
|
$NumericEx {100};
|
|
|
|
$ALetterEx {200};
|
2008-04-04 22:47:43 +00:00
|
|
|
$KatakanaEx {300}; # note: these status values override those from rule 5
|
|
|
|
$HiraganaEx {300}; # by virtual of being numerically larger.
|
|
|
|
$IdeographicEx {400}; #
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2008-04-04 22:47:43 +00:00
|
|
|
#
|
2004-10-21 01:03:01 +00:00
|
|
|
# rule 5
|
2008-04-04 22:47:43 +00:00
|
|
|
# Do not break between most letters.
|
|
|
|
#
|
2005-09-10 03:52:54 +00:00
|
|
|
$ALetterEx $ALetterEx {200};
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 6 and 7
|
2008-04-04 22:47:43 +00:00
|
|
|
$ALetterEx ($MidLetterEx | $MidNumLetEx) $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
|
|
|
|
|
2008-04-04 22:47:43 +00:00
|
|
|
$ALetterEx $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
|
|
|
|
|
2008-04-04 22:47:43 +00:00
|
|
|
$NumericEx ($MidNumEx | $MidNumLetEx) $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)
|
2008-04-04 22:47:43 +00:00
|
|
|
$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;
|
2008-04-04 22:47:43 +00:00
|
|
|
$BackMidNumLetEx = ($Format | $Extend)* $MidNumLet;
|
2006-08-11 19:37:57 +00:00
|
|
|
$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
|
2008-04-04 22:47:43 +00:00
|
|
|
$LF $CR;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
2006-08-11 19:37:57 +00:00
|
|
|
# rule 4
|
2008-04-04 22:47:43 +00:00
|
|
|
($Format | $Extend)* [^$CR $LF $Newline]?;
|
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
|
|
|
|
|
2008-04-04 22:47:43 +00:00
|
|
|
$BackALetterEx ($BackMidLetterEx | $BackMidNumLetEx) $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
|
|
|
|
|
2008-04-04 22:47:43 +00:00
|
|
|
$BackNumericEx ($BackMidNumEx | $BackMidNumLetEx) $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
|
|
|
|
#
|
2008-04-04 22:47:43 +00:00
|
|
|
$BackExtendNumLetEx ($BackALetterEx | $BackNumericEx | $BackKatakanaEx | $BackExtendNumLetEx);
|
|
|
|
($BackALetterEx | $BackNumericEx | $BackKatakanaEx) $BackExtendNumLetEx;
|
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
|
2008-04-04 22:47:43 +00:00
|
|
|
($MidLetter | $MidNumLet) $BackALetterEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 11
|
2008-04-04 22:47:43 +00:00
|
|
|
($MidNum | $MidNumLet) $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
|
2008-04-04 22:47:43 +00:00
|
|
|
($MidLetterEx | $MidNumLetEx) $ALetterEx;
|
2004-10-21 01:03:01 +00:00
|
|
|
|
|
|
|
# rule 11
|
2008-04-04 22:47:43 +00:00
|
|
|
($MidNumEx | $MidNumLetEx) $NumericEx;
|
2005-04-22 21:49:52 +00:00
|
|
|
|
2006-03-23 00:54:12 +00:00
|
|
|
# For dictionary-based break
|
|
|
|
$dictionary $dictionary;
|