private static void processFile(File f, DocumentProcessor<Object> processor) throws IOException { Document document = XStreamer.loadObjectFromFile(f, Document.class); /* Since we're trying to match tag-combinations to categories, we'll skip * any documents which don't have any category information */ if (document.getSpace(SpaceType.CATEGORY) != null) { Space tagSpace = document.getSpace(SpaceType.TAG); processor.addTextInfo(document, tagSpace); } }
@Override public PermutatedSpace permutate(Document document, Space s) { Map<TermSet, Double> returnValue = new HashMap<TermSet, Double>(); List<Term> ti = s.getTextInfo(); for (int i = 0; i < ti.size(); i++) { TreeSet<Term> set = new TreeSet<Term>(); Term t = ti.get(i); set.add(t); TermSet termSet = new TermSet(set); if (!returnValue.containsKey(termSet)) { returnValue.put(termSet, s.getTermWeight(t)); } } return new PermutatedSpace(document.getID() + "." + s.getID(), s, returnValue); }