2002-06-25 17:23:07 +00:00
|
|
|
#
|
2003-11-25 00:23:46 +00:00
|
|
|
# Copyright (C) 2002-2003,
|
2003-11-05 23:50:39 +00:00
|
|
|
# International Business Machines Corporation 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.
|
2003-05-29 21:15:14 +00:00
|
|
|
# These rules are based on Version 4.0.0, dated 2003-04-17
|
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-11-06 19:45:57 +00:00
|
|
|
!!LBCMNoChain;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
2003-11-25 00:23:46 +00:00
|
|
|
$Katakana = [[:Script = KATAKANA:]
|
|
|
|
[:name = KATAKANA-HIRAGANA PROLONGED SOUND MARK:]
|
|
|
|
[:name = HALFWIDTH KATAKANA-HIRAGANA PROLONGED SOUND MARK:]
|
|
|
|
[:name = HALFWIDTH KATAKANA VOICED SOUND MARK:]
|
|
|
|
[:name = HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK:]];
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2002-07-22 22:02:08 +00:00
|
|
|
|
2003-11-25 00:23:46 +00:00
|
|
|
$ALetter = [[:Alphabetic:] [:name= HEBREW PUNCTUATION GERESH:]
|
|
|
|
- [:Ideographic:]
|
|
|
|
- $Katakana
|
|
|
|
- [:Script = Thai:]
|
|
|
|
- [:Script = Lao:]
|
|
|
|
- [:Script = Hiragana:]];
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
$ABaseLetter = [$ALetter - [:Grapheme_Extend = TRUE:]];
|
|
|
|
$ACMLetter = [$ALetter & [:Grapheme_Extend = TRUE:]];
|
2003-11-25 00:23:46 +00:00
|
|
|
|
|
|
|
$MidLetter = [[:name = APOSTROPHE:] [:name = MIDDLE DOT:]
|
|
|
|
[:name = HEBREW PUNCTUATION GERSHAYIM:]
|
|
|
|
[:name = RIGHT SINGLE QUOTATION MARK:]
|
|
|
|
[:name = HYPHENATION POINT:]];
|
|
|
|
|
2003-04-08 05:35:13 +00:00
|
|
|
$MidNumLet = [[:name = FULL STOP:] [:name = COLON:]];
|
|
|
|
|
|
|
|
$MidNum = [[:LineBreak = Infix_Numeric:] - $MidNumLet];
|
|
|
|
$Numeric = [:LineBreak = Numeric:];
|
|
|
|
|
2002-07-22 22:02:08 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
# Character Class Definitions.
|
|
|
|
# The names are those from TR29.
|
|
|
|
#
|
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
$CR = \u000d;
|
|
|
|
$LF = \u000a;
|
|
|
|
$Control = [[:Zl:] [:Zp:] [:Cc:] [:Cf:]];
|
2003-11-25 00:23:46 +00:00
|
|
|
$Extend = [[:Grapheme_Extend = TRUE:]];
|
|
|
|
$Format = [[:Cf:]];
|
2003-11-05 23:50:39 +00:00
|
|
|
$Hiragana = [:Hiragana:];
|
|
|
|
$Ideographic = [:IDEOGRAPHIC:];
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!forward;
|
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
$CR $LF;
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
# rule 3 and 4
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2003-11-25 00:23:46 +00:00
|
|
|
$ALetterEx = $ALetter $Extend*;
|
|
|
|
$ABaseLetterEx = $ABaseLetter $Extend*;
|
|
|
|
$ACMLetterEx = $ACMLetter $Extend*;
|
2003-11-05 23:50:39 +00:00
|
|
|
$NumericEx = $Numeric $Extend*;
|
|
|
|
$MidNumEx = $MidNum $Extend*;
|
|
|
|
$MidNumLetEx = $MidNumLet $Extend*;
|
|
|
|
$MidLetterEx = $MidLetter $Extend*;
|
|
|
|
$KatakanaEx = $Katakana $Extend*;
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
# see character breaks
|
|
|
|
|
2003-11-25 00:23:46 +00:00
|
|
|
[^$Control] $Extend*;
|
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
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
$ALetterEx ($Format* $ALetterEx)* {200};
|
2002-07-22 22:02:08 +00:00
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
# rule 6 and 7
|
2002-07-22 22:02:08 +00:00
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
$MidALetterEx = ($ABaseLetterEx | $Format $ACMLetterEx);
|
|
|
|
|
|
|
|
$ALetterSeq =
|
|
|
|
$ALetterEx
|
|
|
|
(
|
|
|
|
$Format* ($MidLetterEx | $MidNumLetEx) $Format* $MidALetterEx
|
|
|
|
)*;
|
|
|
|
|
|
|
|
$MidALetterSeq =
|
|
|
|
$MidALetterEx
|
|
|
|
(
|
|
|
|
$Format* ($MidLetterEx | $MidNumLetEx) $Format* $MidALetterEx
|
|
|
|
)*;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 8
|
|
|
|
|
|
|
|
$NumericEx ($Format* $NumericEx)* {100};
|
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
# rule 9
|
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
$ALetterSeq ($Format* ($NumericEx | $MidALetterSeq))* {200};
|
2003-11-07 00:04:13 +00:00
|
|
|
|
|
|
|
# rule 10
|
2003-11-05 23:50:39 +00:00
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
$NumericEx ($Format* $MidALetterSeq)+ ($Format* $NumericEx)* {200};
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 11 and 12
|
|
|
|
|
2003-11-25 00:23:46 +00:00
|
|
|
$NumericEx ($Format* ($MidNumEx | $MidNumLetEx) $Format* $NumericEx)+ {100};
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 13
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2003-10-02 22:34:25 +00:00
|
|
|
$KatakanaEx ($Format* $KatakanaEx)* {300};
|
2003-11-25 00:23:46 +00:00
|
|
|
$Hiragana $Extend* {300};
|
2003-11-06 19:45:57 +00:00
|
|
|
$Ideographic $Extend* {400};
|
2002-06-25 17:23:07 +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
|
|
|
|
2003-11-05 23:50:39 +00:00
|
|
|
$BackALetterEx = $Extend* $ALetter;
|
|
|
|
$BackABaseLetterEx = $Extend* $ABaseLetter;
|
|
|
|
$BackACMLetterEx = $Extend* $ACMLetter;
|
|
|
|
$BackNumericEx = $Extend* $Numeric;
|
|
|
|
$BackMidNumEx = $Extend* $MidNum;
|
|
|
|
$BackMidNumLetEx = $Extend* $MidNumLet;
|
|
|
|
$BackMidLetterEx = $Extend* $MidLetter;
|
|
|
|
$BackKatakanaEx = $Extend* $Katakana;
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
$LF $CR;
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
# see character breaks
|
|
|
|
|
|
|
|
$Extend* [^$Control];
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 5
|
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
($BackALetterEx $Format*)* $BackABaseLetterEx;
|
2003-11-11 05:00:08 +00:00
|
|
|
($BackALetterEx $Format*)* $BackACMLetterEx / $Control;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 6 and 7
|
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
$BackMidALetterEx = ($BackABaseLetterEx | $BackACMLetterEx $Format);
|
|
|
|
|
|
|
|
$BackALetterSeq =
|
2003-11-07 00:04:13 +00:00
|
|
|
(
|
2003-11-11 05:00:08 +00:00
|
|
|
$BackMidALetterEx $Format* ($BackMidLetterEx | $BackMidNumLetEx) $Format*
|
|
|
|
)*
|
|
|
|
$BackABaseLetterEx;
|
|
|
|
|
|
|
|
$BackMidALetterSeq =
|
2003-11-07 00:04:13 +00:00
|
|
|
(
|
2003-11-11 05:00:08 +00:00
|
|
|
$BackMidALetterEx $Format* ($BackMidLetterEx | $BackMidNumLetEx) $Format*
|
|
|
|
)*
|
|
|
|
$BackMidALetterEx;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 8
|
|
|
|
|
2003-11-25 00:23:46 +00:00
|
|
|
$BackNumericEx $Format* $BackNumericEx;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
# rule 10
|
|
|
|
|
|
|
|
(($BackNumericEx | $BackMidALetterSeq) $Format*)* $BackALetterSeq;
|
|
|
|
|
|
|
|
# to handle letter sequences ending with a combining mark
|
|
|
|
(($BackNumericEx | $BackMidALetterSeq) $Format*)*
|
|
|
|
(
|
|
|
|
$BackMidALetterEx $Format* ($BackMidLetterEx | $BackMidNumLetEx) $Format*
|
|
|
|
)*
|
|
|
|
$BackACMLetterEx / $Control;
|
|
|
|
|
|
|
|
# rule 10
|
2003-11-05 23:50:39 +00:00
|
|
|
|
2003-11-11 05:00:08 +00:00
|
|
|
($BackNumericEx $Format*)* ($BackMidALetterSeq $Format*)* $BackNumericEx;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 11 and 12
|
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
$BackNumericEx $Format* ($BackMidNumEx | $BackMidNumLetEx) $Format* $BackNumericEx;
|
2003-11-05 23:50:39 +00:00
|
|
|
|
|
|
|
# rule 13
|
2002-08-09 03:14:43 +00:00
|
|
|
|
2003-11-07 00:04:13 +00:00
|
|
|
$BackKatakanaEx $Format* $BackKatakanaEx;
|
|
|
|
|
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!safe_reverse;
|
|
|
|
|
2003-11-09 06:52:44 +00:00
|
|
|
# rule 3
|
|
|
|
$Extend+ [^$Extend];
|
|
|
|
|
|
|
|
# rule 4
|
|
|
|
$Format+ $BackABaseLetterEx;
|
2003-11-11 05:00:08 +00:00
|
|
|
$Format+ $BackACMLetterEx / $Control;
|
2003-11-09 06:52:44 +00:00
|
|
|
$Format+ $BackNumericEx;
|
|
|
|
$Format+ $BackMidLetterEx;
|
|
|
|
$Format+ $BackMidNumLetEx;
|
|
|
|
$Format+ $BackMidNumEx;
|
|
|
|
$Format+ $BackKatakanaEx;
|
|
|
|
|
|
|
|
# rule 6
|
|
|
|
($MidLetter | $MidNumLet) $Format* $BackABaseLetterEx;
|
2003-11-11 05:00:08 +00:00
|
|
|
($MidLetter | $MidNumLet) $Format* $BackACMLetterEx / $Control;
|
2003-11-09 06:52:44 +00:00
|
|
|
|
|
|
|
# rule 11
|
|
|
|
($MidNum | $MidNumLet) $Format* $BackNumericEx;
|
|
|
|
|
|
|
|
## -------------------------------------------------
|
|
|
|
|
|
|
|
!!safe_forward;
|
|
|
|
|
|
|
|
# rule 3
|
|
|
|
$Extend+;
|
|
|
|
|
|
|
|
# rule 4
|
|
|
|
$Format+ $ALetterEx;
|
|
|
|
$Format+ $NumericEx;
|
|
|
|
$Format+ $MidLetterEx;
|
|
|
|
$Format+ $MidNumLetEx;
|
|
|
|
$Format+ $MidNumEx;
|
|
|
|
$Format+ $KatakanaEx;
|
|
|
|
|
|
|
|
# rule 6
|
|
|
|
($MidLetter | $MidNumLet) $Format* $ALetterEx;
|
|
|
|
|
|
|
|
# rule 11
|
|
|
|
($MidNum | $MidNumLet) $Format* $NumericEx;
|