public override double stringDistance(String stringA, String stringB) { HashSet<string> ha = new HashSet<string>(); HashSet<string> hb = new HashSet<string>(); long pos = ms.Position; tw.WriteLine(stringA); tw.Flush(); ms.Position = pos; Lucene.Net.Analysis.Token t = filt.Next(); while (t != null) { ha.Add(t.TermText()); t = filt.Next(); } pos = ms.Position; tw.WriteLine(stringB); tw.Flush(); ms.Position = pos; Lucene.Net.Analysis.Token tb = filt.Next(); while (tb != null) { hb.Add(tb.TermText()); tb = filt.Next(); } double uc = ha.Union(hb).Count(); double ic = ha.Intersect(hb).Count(); return (uc - ic) / uc; }