19 using System.Collections.Generic;
20 using Lucene.Net.Analysis.Tokenattributes;
22 namespace Lucene.Net.Analysis.Fr
37 private static char[] apostrophes = {
'\'',
'’' };
39 public void SetArticles(ISet<string> articles)
42 this.articles = (CharArraySet)articles;
44 this.articles =
new CharArraySet(articles,
true);
51 : this(input, new[] {
"l",
"m",
"t",
"qu",
"n",
"s",
"j" })
60 SetArticles(articles);
61 termAtt = AddAttribute<ITermAttribute>();
71 termAtt = AddAttribute<ITermAttribute>();
77 public override sealed
bool IncrementToken()
79 if (input.IncrementToken())
81 char[] termBuffer = termAtt.TermBuffer();
82 int termLength = termAtt.TermLength();
84 int minPoz =
int.MaxValue;
85 for (
int i = 0; i < apostrophes.Length; i++)
87 char apos = apostrophes[i];
89 for (
int poz = 0; poz < termLength; poz++)
91 if (termBuffer[poz] == apos)
93 minPoz = Math.Min(poz, minPoz);
100 if (minPoz !=
int.MaxValue
101 && articles.Contains(termAtt.TermBuffer(), 0, minPoz))
103 termAtt.SetTermBuffer(termAtt.TermBuffer(), minPoz + 1, termAtt.TermLength() - (minPoz + 1));