2002-06-25 17:23:07 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
# Copyright (C) 2002, International Business Machines Corporation and others.
|
|
|
|
# All Rights Reserved.
|
|
|
|
#
|
|
|
|
# file: word.txt
|
|
|
|
#
|
|
|
|
# ICU Word Break Rules
|
|
|
|
# See Unicode Technical Report #29.
|
|
|
|
# These rules are based on the proposed draft dated 2002-08-06
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-07-22 22:02:08 +00:00
|
|
|
####################################################################################
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
# Definitions imported from Line Break Rules.
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2002-07-22 22:02:08 +00:00
|
|
|
####################################################################################
|
|
|
|
$Numeric = [ \u0030-\u0039 \u0660-\u0669 \u06F0-\u06F9 \u0966-\u096F \u09E6-\u09EF
|
|
|
|
\u0A66-\u0A6F \u0AE6-\u0AEF \u0B66-\u0B6F \u0BE7-\u0BEF \u0C66-\u0C6F
|
|
|
|
\u0CE6-\u0CEF \u0D66-\u0D6F \u0E50-\u0E59 \u0ED0-\u0ED9 \u0F20-\u0F29
|
|
|
|
\u1040-\u1049 \u1369-\u1371 \u17E0-\u17E9 \u1810-\u1819 \U0001D7CE-\U0001D7FF];
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2002-07-22 22:02:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
####################################################################################
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2002-07-22 22:02:08 +00:00
|
|
|
# Definitions imported from Character Break Rules.
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
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.
|
|
|
|
#
|
|
|
|
$Control = [[:Zl:] [:Zp:] [:Cc:] [:Cf:]];
|
|
|
|
|
|
|
|
# Note on $Extend: Earlier versions of TR29 included Mc characters.
|
|
|
|
# To avoid test breakage, Mc is still included for the time being.
|
|
|
|
# $Extend = [[:Mn:] [:Me:] \uff9e-\uff9f]; # FF9E..FF9F ; Other_Grapheme_Extend
|
|
|
|
$Extend = [[:Mn:] [:Me:] [:Mc:] \uff9e-\uff9f]; # FF9E..FF9F ; Other_Grapheme_Extend
|
|
|
|
|
|
|
|
|
|
|
|
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2002-07-22 22:02:08 +00:00
|
|
|
####################################################################################
|
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
# Word Break Rules. Definitions and Rules specific to word break begin Here.
|
2002-07-22 22:02:08 +00:00
|
|
|
#
|
|
|
|
####################################################################################
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2002-08-09 03:14:43 +00:00
|
|
|
$Katakana = [[:Kana:] \u30fc \uff70 \uff9e-\uff9f];
|
|
|
|
$Hiragana = [[:Hira:]];
|
|
|
|
$Letter = [[[:Alphabetic:] \u02b9-\u02ba \u02c2-\u02cf \u02d2-\u02df \u02e5-\u02ed \u05f3] -
|
|
|
|
[[:IDEOGRAPHIC:] [:THAI:] [:LAO:] $Hiragana $Katakana ]];
|
|
|
|
$Format = [[:Cf:]];
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2002-08-09 03:14:43 +00:00
|
|
|
$MidLetter = [\u0027 \u00ad \u05f4 \u2019];
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2002-08-09 03:14:43 +00:00
|
|
|
$MidNumLet = [\u002e \u003a];
|
|
|
|
|
|
|
|
|
|
|
|
# From Line Break, IS - Numeric Separator (Infix)
|
|
|
|
# $IS = [\u002c \u002e \u003a \u003b \u0589];
|
|
|
|
$MidNum = [\u002c \u003b \u0589];
|
2002-06-25 17:23:07 +00:00
|
|
|
|
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
# "Extended" definitions. Classes of characters including trailing combining chars and,
|
|
|
|
# for types of chars that can appear in the interior of a word only,
|
|
|
|
# trailing format characters.
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
$LetterEx = $Letter $Extend*;
|
|
|
|
$NumericEx = $Numeric $Extend*;
|
|
|
|
$MidNumExF = $MidNum $Extend* $Format*;
|
|
|
|
$MidNumLetExF = $MidNumLet $Extend* $Format*;
|
|
|
|
$MidLetterExF = $MidLetter $Extend* $Format*;
|
|
|
|
|
2002-07-22 22:02:08 +00:00
|
|
|
|
2002-08-09 03:14:43 +00:00
|
|
|
#
|
|
|
|
# Numbers. Rules 6, 9, 10 form the TR.
|
|
|
|
#
|
|
|
|
$NumberSequence = $NumericEx ($Format* ($MidNumExF | $MidNumLetExF)? $NumericEx)*;
|
|
|
|
$NumberSequence {100};
|
2002-07-22 22:02:08 +00:00
|
|
|
|
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
# Words. Alpha-numerics. Rule 3 - 10
|
2002-07-22 22:02:08 +00:00
|
|
|
# - must include at least one letter.
|
|
|
|
# - may include both letters and numbers.
|
2002-08-09 03:14:43 +00:00
|
|
|
# - may include MideLetter, MidNumber punctuation.
|
2002-07-22 22:02:08 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
$LetterSequence = $LetterEx ($Format* ($MidLetterExF | $MidNumLetExF)? $LetterEx)*;
|
|
|
|
$NumberSequence? $LetterSequence ($NumberSequence | $LetterSequence)* {200};
|
2002-06-25 17:23:07 +00:00
|
|
|
|
|
|
|
#
|
2002-07-24 19:10:18 +00:00
|
|
|
# Hiragana and Katakana
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
$Hiragana $Extend* {300};
|
|
|
|
$Katakana $Extend* ($Format* $Katakana $Extend*)* {300};
|
2002-06-25 17:23:07 +00:00
|
|
|
|
2002-07-24 19:10:18 +00:00
|
|
|
#
|
|
|
|
# Ideographic Characters. Stand by themselves as words.
|
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
[:IDEOGRAPHIC:] $Extend* {400};
|
2002-07-24 19:10:18 +00:00
|
|
|
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
# Everything Else, with no tag.
|
|
|
|
# Non-Control chars combine with $Extend (combining) chars.
|
|
|
|
# Controls are returned by themselves.
|
2002-06-25 17:23:07 +00:00
|
|
|
#
|
2002-08-09 03:14:43 +00:00
|
|
|
[^$Control] $Extend*;
|
2002-06-25 17:23:07 +00:00
|
|
|
\r\n;
|
|
|
|
.;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Reverse Rules. Back up over any of the chars that can group together.
|
2002-08-09 03:14:43 +00:00
|
|
|
# (Reverse rules do not need to be exact; they can back up too far,
|
|
|
|
# but must back up at least enough, and must stop on a boundary.)
|
|
|
|
#
|
|
|
|
|
|
|
|
# NonStarters are the set of all characters that can appear at the 2nd - nth position of
|
|
|
|
# a word. (They may also be the first.) The reverse rule skips over these, until it
|
|
|
|
# reaches something that can only be the start (and probably only) char in a "word".
|
|
|
|
# A space or punctuation meets the test.
|
|
|
|
#
|
|
|
|
$NonStarters = [$Numeric $Letter $Katakana $MidLetter $MidNum $MidNumLet $Extend $Format \u000a];
|
|
|
|
|
|
|
|
! $NonStarters* .;
|