@Test public void filter_nonStopwords() { UnigramStopwordFilter target = new UnigramStopwordFilter(tokens, parameterSet); Parsing parsing = new Parsing(tokens, 0); String [] expected = new String [] {"in at engineer quality assurance"}; TreeSet<Parsing> parsings = new TreeSet<Parsing>(); parsings.add(parsing); target.filterParsings(parsings, new ArrayList<TreeMap<String,Object>>()); String [] actual = parsings.first().toStringArray(); for(int i = 0; i < actual.length; ++i) { Assert.assertTrue(expected[i].compareTo(actual[i])== 0); } }
public void filterParsings(TreeSet<Parsing> parsings, List<TreeMap<String,Object>> output){ HashSet<String> uniqueParsings = new HashSet<String>(); int parsingCount = 0; for(Iterator<Parsing> iter = parsings.descendingIterator(); iter.hasNext() && parsingCount < parameterSet.resultLimit;) { Parsing parsing = iter.next(); filterParsing(parsing); if (uniqueParsings.contains(parsing.toString())) { iter.remove(); } else { parsingCount++; uniqueParsings.add(parsing.toString()); } } }
UnigramStopwordFilter implements ITermFilter { public void filterParsings(TreeSet<Parsing> parsings, List<TreeMap<String,Object>> output){ HashSet<String> uniqueParsings = new HashSet<String>(); int parsingCount = 0; for(Iterator<Parsing> iter = parsings.descendingIterator(); iter.hasNext() && parsingCount < parameterSet.resultLimit;) { Parsing parsing = iter.next(); filterParsing(parsing); if (uniqueParsings.contains(parsing.toString())) { iter.remove(); } else { parsingCount++; uniqueParsings.add(parsing.toString()); } } } }
UnigramStopwordFilter implements ITermFilter { public void filterParsings(TreeSet<Parsing> parsings, List<TreeMap<String,Object>> output){ HashSet<String> uniqueParsings = new HashSet<String>(); int parsingCount = 0; for(Iterator<Parsing> iter = parsings.descendingIterator(); iter.hasNext() && parsingCount < parameterSet.resultLimit;) { Parsing parsing = iter.next(); filterParsing(parsing); if (uniqueParsings.contains(parsing.toString())) { iter.remove(); } else { parsingCount++; uniqueParsings.add(parsing.toString()); } } } UnigramStopwordFilter(TokenizedString tokens,
                                 ParseParameterSet parameterSet); }
UnigramStopwordFilter implements ITermFilter { public void filterParsings(TreeSet<Parsing> parsings, List<TreeMap<String,Object>> output){ HashSet<String> uniqueParsings = new HashSet<String>(); int parsingCount = 0; for(Iterator<Parsing> iter = parsings.descendingIterator(); iter.hasNext() && parsingCount < parameterSet.resultLimit;) { Parsing parsing = iter.next(); filterParsing(parsing); if (uniqueParsings.contains(parsing.toString())) { iter.remove(); } else { parsingCount++; uniqueParsings.add(parsing.toString()); } } } UnigramStopwordFilter(TokenizedString tokens,
                                 ParseParameterSet parameterSet); void filterParsings(TreeSet<Parsing> parsings, List<TreeMap<String,Object>> output); }
UnigramStopwordFilter implements ITermFilter { public void filterParsings(TreeSet<Parsing> parsings, List<TreeMap<String,Object>> output){ HashSet<String> uniqueParsings = new HashSet<String>(); int parsingCount = 0; for(Iterator<Parsing> iter = parsings.descendingIterator(); iter.hasNext() && parsingCount < parameterSet.resultLimit;) { Parsing parsing = iter.next(); filterParsing(parsing); if (uniqueParsings.contains(parsing.toString())) { iter.remove(); } else { parsingCount++; uniqueParsings.add(parsing.toString()); } } } UnigramStopwordFilter(TokenizedString tokens,
                                 ParseParameterSet parameterSet); void filterParsings(TreeSet<Parsing> parsings, List<TreeMap<String,Object>> output);  }