@@ -820,8 +820,12 @@ func governingClauseStart(line string, nameAt int) int {
820820 start := 0
821821 for index := 0 ; index < nameAt ; index ++ {
822822 switch line [index ] {
823- case ';' , ':' , '.' , '!' , '?' :
823+ case ';' , ':' :
824824 start = index + 1
825+ default :
826+ if sentenceTerminatorAt (line , index ) {
827+ start = index + 1
828+ }
825829 }
826830 }
827831 return start
@@ -969,8 +973,7 @@ func durationHasElapsedRole(text string, begin, end int) bool {
969973
970974func comparativeDurationSuffix (text string ) bool {
971975 words := asciiWords (strings .TrimSpace (text ))
972- return len (words ) >= 2 && words [1 ] == "than" &&
973- (words [0 ] == "less" || words [0 ] == "more" || words [0 ] == "faster" || words [0 ] == "slower" )
976+ return len (words ) >= 2 && words [1 ] == "than"
974977}
975978
976979// affirmativeCueLead binds the result verb to the measured name. These are the
@@ -1217,22 +1220,29 @@ var clauseSeparators = []string{
12171220// sits between two digits.
12181221func sentenceEnd (line string , from int ) int {
12191222 for index := from ; index < len (line ); index ++ {
1220- switch line [index ] {
1221- case '.' , '!' , '?' :
1222- default :
1223- continue
1224- }
1225- if line [index ] == '.' && index > 0 && index + 1 < len (line ) &&
1226- isDigitByte (line [index - 1 ]) && isDigitByte (line [index + 1 ]) {
1227- continue
1228- }
1229- if index + 1 >= len (line ) || line [index + 1 ] == ' ' || line [index + 1 ] == '\t' {
1223+ if sentenceTerminatorAt (line , index ) {
12301224 return index
12311225 }
12321226 }
12331227 return - 1
12341228}
12351229
1230+ func sentenceTerminatorAt (line string , index int ) bool {
1231+ if index < 0 || index >= len (line ) {
1232+ return false
1233+ }
1234+ switch line [index ] {
1235+ case '.' , '!' , '?' :
1236+ default :
1237+ return false
1238+ }
1239+ if line [index ] == '.' && index > 0 && index + 1 < len (line ) &&
1240+ isDigitByte (line [index - 1 ]) && isDigitByte (line [index + 1 ]) {
1241+ return false
1242+ }
1243+ return index + 1 >= len (line ) || line [index + 1 ] == ' ' || line [index + 1 ] == '\t'
1244+ }
1245+
12361246func isDigitByte (b byte ) bool { return b >= '0' && b <= '9' }
12371247
12381248// nextNameShaped returns the offset of the next token that looks like a name
0 commit comments