public void PerformStep5Correctly(string from, string to) { var filter = new PorterStemmerFilter(); using (var reader = new StringReader(from)) { var tokenSource = new TokenSource(reader); tokenSource.Next(); filter.PerformStep5(tokenSource); Assert.Equal(to, tokenSource.ToString()); } }
public void RemovePossesiveSufixWhenItIsPresent(string from, string to) { var filter = new RemovePossesiveSufixFilter(); using (var reader = new StringReader(from)) { var tokenSource = new TokenSource(reader); tokenSource.Next(); Assert.True(filter.Process(tokenSource)); Assert.Equal(to, tokenSource.ToString()); } }
public static Query From(string term, IAnalyzer analyzer) { using (var reader = new StringReader(term)) { var tokenSource = new TokenSource(reader); tokenSource.Next(); if (!analyzer.Process(tokenSource)) { throw new InvalidOperationException($"Could not generate a term from: {term}"); } return(new TermQuery(tokenSource.ToString())); } }