Skip to content

Commit eb5c48a

Browse files
committed
ICU-23440 Merge the end-of-text and Sentence_Break=Sep symbols in the sentence breaking state machine
1 parent fc47e8b commit eb5c48a

4 files changed

Lines changed: 12 additions & 2 deletions

File tree

icu4c/source/data/brkitr/rules/sent.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ $ATermEx $CloseEx* $SpEx* $NotLettersEx* $Lower;
7676
($STermEx | $ATermEx) $CloseEx* $SpEx* ($SContinueEx | $STermEx | $ATermEx);
7777

7878
#Rule 9, 10, 11
79-
($STermEx | $ATermEx) $CloseEx* $SpEx* ($Sep | $CR | $LF)?;
79+
# Including {eof} here does not change the observable behaviour (if {eof} were not here, on STerm at
80+
# the end of text, we would reach an accepting state which would have no transition on the {eof}
81+
# symbol, and break at the end of text with status 0), but it allows us to merge the {eof} and Sep
82+
# symbols; on STerm at the end of text or before Sep, we transition on {eof} or Sep to the same
83+
# state and accept that one.
84+
($STermEx | $ATermEx) $CloseEx* $SpEx* [$Sep $LF $CR {eof}]?;
8085

8186
#Rule 998
8287
[^$STerm $ATerm $Close $Sp $Sep $LF $CR $Format $Extend] ($Extend | $Format | $Close | $Sp)* .;

icu4c/source/data/brkitr/rules/sent_el.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,12 @@ $ATermEx $CloseEx* $SpEx* $NotLettersEx* $Lower;
7676
($STermEx | $ATermEx) $CloseEx* $SpEx* ($SContinueEx | $STermEx | $ATermEx);
7777

7878
#Rule 9, 10, 11
79-
($STermEx | $ATermEx) $CloseEx* $SpEx* ($Sep | $CR | $LF)?;
79+
# Including {eof} here does not change the observable behaviour (if {eof} were not here, on STerm at
80+
# the end of text, we would reach an accepting state which would have no transition on the {eof}
81+
# symbol, and break at the end of text with status 0), but it allows us to merge the {eof} and Sep
82+
# symbols; on STerm at the end of text or before Sep, we transition on {eof} or Sep to the same
83+
# state and accept that one.
84+
($STermEx | $ATermEx) $CloseEx* $SpEx* [$Sep $LF $CR {eof}]?;
8085

8186
#Rule 998
8287
[^$STerm $ATerm $Close $Sp $Sep $LF $CR $Format $Extend] ($Extend | $Format | $Close | $Sp)* .;
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)