Bernhard's fix for '��' not being replaced at the end of a word + plus a small code simplification by me

PR: 29931
Submitted by:	Bernhard Messer


git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150413 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Daniel Naber 2004-08-10 19:02:47 +00:00
parent 67b295c3a8
commit b1a8660d17
1 changed files with 7 additions and 5 deletions

View File

@ -178,15 +178,16 @@ public class GermanStemmer
else if ( buffer.charAt( c ) == 'ü' ) {
buffer.setCharAt( c, 'u' );
}
// Take care that at least one character is left left side from the current one
if ( c < buffer.length() - 1 ) {
if ( buffer.charAt( c ) == 'ß' ) {
// Fix bug so that 'ß' at the end of a word is replaced.
else if ( buffer.charAt( c ) == 'ß' ) {
buffer.setCharAt( c, 's' );
buffer.insert( c + 1, 's' );
substCount++;
}
}
// Take care that at least one character is left left side from the current one
if ( c < buffer.length() - 1 ) {
// Masking several common character combinations with an token
else if ( ( c < buffer.length() - 2 ) && buffer.charAt( c ) == 's' &&
if ( ( c < buffer.length() - 2 ) && buffer.charAt( c ) == 's' &&
buffer.charAt( c + 1 ) == 'c' && buffer.charAt( c + 2 ) == 'h' )
{
buffer.setCharAt( c, '$' );
@ -260,4 +261,5 @@ public class GermanStemmer
}
}
}
}