19 using Lucene.Net.Analysis.Tokenattributes;
21 namespace Lucene.Net.Analysis
36 [Obsolete(
"If you build a new index, use ASCIIFoldingFilter which covers a superset of Latin 1. This class is included for use with existing indexes and will be removed in a future release (possible Lucene 4.0).")]
41 termAtt = AddAttribute<ITermAttribute>();
44 private char[] output =
new char[256];
45 private int outputPos;
48 public override bool IncrementToken()
50 if (input.IncrementToken())
53 int length = termAtt.TermLength();
56 for (
int i = 0; i < length; i++)
59 if (c >=
'\u00c0' && c <=
'\uFB06')
61 RemoveAccents(buffer, length);
62 termAtt.SetTermBuffer(output, 0, outputPos);
72 public void RemoveAccents(
char[] input,
int length)
76 int maxSizeNeeded = 2 * length;
78 int size = output.Length;
79 while (size < maxSizeNeeded)
82 if (size != output.Length)
83 output =
new char[size];
89 for (
int i = 0; i < length; i++, pos++)
95 if (c < '\u00c0' || c >
'\uFB06')
96 output[outputPos++] = c;
113 output[outputPos++] =
'A';
117 output[outputPos++] =
'A';
118 output[outputPos++] =
'E';
122 output[outputPos++] =
'C';
132 output[outputPos++] =
'E';
142 output[outputPos++] =
'I';
146 output[outputPos++] =
'I';
147 output[outputPos++] =
'J';
151 output[outputPos++] =
'D';
155 output[outputPos++] =
'N';
169 output[outputPos++] =
'O';
173 output[outputPos++] =
'O';
174 output[outputPos++] =
'E';
178 output[outputPos++] =
'T';
179 output[outputPos++] =
'H';
189 output[outputPos++] =
'U';
195 output[outputPos++] =
'Y';
209 output[outputPos++] =
'a';
213 output[outputPos++] =
'a';
214 output[outputPos++] =
'e';
218 output[outputPos++] =
'c';
228 output[outputPos++] =
'e';
238 output[outputPos++] =
'i';
242 output[outputPos++] =
'i';
243 output[outputPos++] =
'j';
247 output[outputPos++] =
'd';
251 output[outputPos++] =
'n';
265 output[outputPos++] =
'o';
269 output[outputPos++] =
'o';
270 output[outputPos++] =
'e';
274 output[outputPos++] =
's';
275 output[outputPos++] =
's';
279 output[outputPos++] =
't';
280 output[outputPos++] =
'h';
290 output[outputPos++] =
'u';
296 output[outputPos++] =
'y';
300 output[outputPos++] =
'f';
301 output[outputPos++] =
'f';
305 output[outputPos++] =
'f';
306 output[outputPos++] =
'i';
310 output[outputPos++] =
'f';
311 output[outputPos++] =
'l';
326 output[outputPos++] =
'f';
327 output[outputPos++] =
't';
331 output[outputPos++] =
's';
332 output[outputPos++] =
't';
336 output[outputPos++] = c;