예제 #1
0
 public void saveToWriter(BufferedWriter out) throws IOException {
   out.write("<contextcounts corpus=\"" + DepNeighbourhoodSpace.getName() + "\">\n");
   for (String depRelation : depRelationWordCountMap.keySet()) {
     Helper.report(
         "[ContextCounts] Writing counts for dep relation \"" + depRelation + "\" to file");
     out.write("<deprelation name=\"" + depRelation + "\">\n");
     TreeSet<Entry<String, Long>> sortedWordCountMap = getSortedMap(depRelation);
     while (!sortedWordCountMap.isEmpty()) {
       Entry<String, Long> topWordCountPair = sortedWordCountMap.pollLast();
       out.write(topWordCountPair.getValue() + "\t" + topWordCountPair.getKey() + "\n");
     }
     out.write("</deprelation>\n");
   }
   out.write("</contextcounts>\n");
 }