]> git.saurik.com Git - apple/icu.git/blame - icuSources/data/brkitr/sent.txt
ICU-400.37.tar.gz
[apple/icu.git] / icuSources / data / brkitr / sent.txt
CommitLineData
b75a7d8f 1#
46f4442e 2# Copyright (C) 2002-2008, International Business Machines Corporation and others.
b75a7d8f
A
3# All Rights Reserved.
4#
374ca955 5# file: sent.txt
b75a7d8f
A
6#
7# ICU Sentence Break Rules
8# See Unicode Standard Annex #29.
46f4442e 9# These rules are based on SA 29 version 5.1.0
b75a7d8f 10#
374ca955 11
b75a7d8f
A
12
13#
14# Character categories as defined in TR 29
15#
46f4442e
A
16$CR = [\p{Sentence_Break = CR}];
17$LF = [\p{Sentence_Break = LF}];
18$Extend = [\p{Sentence_Break = Extend}];
73c04bcf
A
19$Sep = [\p{Sentence_Break = Sep}];
20$Format = [\p{Sentence_Break = Format}];
21$Sp = [\p{Sentence_Break = Sp}];
22$Lower = [\p{Sentence_Break = Lower}];
23$Upper = [\p{Sentence_Break = Upper}];
46f4442e 24$OLetter = [\p{Sentence_Break = OLetter}];
73c04bcf
A
25$Numeric = [\p{Sentence_Break = Numeric}];
26$ATerm = [\p{Sentence_Break = ATerm}];
46f4442e 27$SContinue = [\p{Sentence_Break = SContinue}];
73c04bcf
A
28$STerm = [\p{Sentence_Break = STerm}];
29$Close = [\p{Sentence_Break = Close}];
b75a7d8f 30
73c04bcf 31#
b75a7d8f 32# Define extended forms of the character classes,
46f4442e 33# incorporate trailing Extend or Format chars.
73c04bcf 34# Rules 4 and 5.
b75a7d8f 35
73c04bcf
A
36$SpEx = $Sp ($Extend | $Format)*;
37$LowerEx = $Lower ($Extend | $Format)*;
38$UpperEx = $Upper ($Extend | $Format)*;
39$OLetterEx = $OLetter ($Extend | $Format)*;
40$NumericEx = $Numeric ($Extend | $Format)*;
41$ATermEx = $ATerm ($Extend | $Format)*;
46f4442e 42$SContinueEx= $SContinue ($Extend | $Format)*;
73c04bcf
A
43$STermEx = $STerm ($Extend | $Format)*;
44$CloseEx = $Close ($Extend | $Format)*;
b75a7d8f 45
b75a7d8f 46
374ca955 47## -------------------------------------------------
b75a7d8f 48
73c04bcf
A
49!!chain;
50!!forward;
374ca955 51
73c04bcf
A
52# Rule 3 - break after separators. Keep CR/LF together.
53#
54$CR $LF;
374ca955 55
374ca955 56
73c04bcf
A
57# Rule 4 - Break after $Sep.
58# Rule 5 - Ignore $Format and $Extend
59#
46f4442e 60[^$Sep $CR $LF]? ($Extend | $Format)*;
374ca955 61
374ca955 62
73c04bcf
A
63# Rule 6
64$ATermEx $NumericEx;
374ca955 65
73c04bcf
A
66# Rule 7
67$UpperEx $ATermEx $UpperEx;
374ca955 68
73c04bcf 69#Rule 8
46f4442e 70$NotLettersEx = [^$OLetter $Upper $Lower $Sep $CR $LF $ATerm $STerm] ($Extend | $Format)*;
73c04bcf 71$ATermEx $CloseEx* $SpEx* $NotLettersEx* $Lower;
374ca955 72
73c04bcf 73# Rule 8a
46f4442e 74($STermEx | $ATermEx) $CloseEx* $SpEx* ($SContinueEx | $STermEx | $ATermEx);
374ca955 75
73c04bcf 76#Rule 9, 10, 11
46f4442e 77($STermEx | $ATermEx) $CloseEx* $SpEx* ($Sep | $CR | $LF)?;
374ca955 78
73c04bcf 79#Rule 12
46f4442e
A
80[[^$STerm $ATerm $Close $Sp $Sep $LF $CR $Format $Extend]{bof}] ($Extend | $Format | $Close | $Sp)* .;
81[[^$STerm $ATerm $Close $Sp $Sep $LF $CR $Format $Extend]{bof}] ($Extend | $Format | $Close | $Sp)* ([$Sep $LF $CR {eof}] | $CR $LF){100};
374ca955
A
82
83## -------------------------------------------------
84
73c04bcf 85!!reverse;
374ca955 86
73c04bcf
A
87$SpEx_R = ($Extend | $Format)* $Sp;
88$ATermEx_R = ($Extend | $Format)* $ATerm;
89$STermEx_R = ($Extend | $Format)* $STerm;
90$CloseEx_R = ($Extend | $Format)* $Close;
374ca955 91
73c04bcf
A
92#
93# Reverse rules.
94# For now, use the old style inexact reverse rules, which are easier
95# to write, but less efficient.
96# TODO: exact reverse rules. It appears that exact reverse rules
97# may require improving support for look-ahead breaks in the
98# builder. Needs more investigation.
99#
374ca955 100
46f4442e 101[{bof}] (.? | $LF $CR) [^$Sep $CR $LF]* [$Sep $CR $LF {eof}] ($SpEx_R* $CloseEx_R* ($STermEx_R | $ATermEx_R))*;
73c04bcf 102#.*;
374ca955 103
73c04bcf
A
104# Explanation for this rule:
105#
106# It needs to back over
107# The $Sep at which we probably begin
108# All of the non $Sep chars leading to the preceding $Sep
109# The preceding $Sep, which will be the second one that the rule matches.
110# Any immediately preceding STerm or ATerm sequences. We need to see these
111# to get the correct rule status when moving forwards again.
112#
113# [{bof}] inhibit rule chaining. Without this, rule would loop on itself and match
114# the entire string.
115#
116# (.? | $LF $CR) Match one $Sep instance. Use .? rather than $Sep because position might be
117# at the beginning of the string at this point, and we don't want to fail.
118# Can only use {eof} once, and it is used later.
119#