sS ai_makeNGramScorer(Cl pos, Cl neg) { Set common = setIntersection(asSet(pos), neg); pos = listMinusSet(pos, common); neg = listMinusSet(neg, common); S s = join("|", pos); if (nempty(neg)) s += "^" + join("|", neg); ret s; }