package mpqareader; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import se.lth.cs.nlp.nlputils.core.IntHistogram; public class TestPosition { private static ArrayList readSentence(BufferedReader br) throws IOException { ArrayList out = new ArrayList(); String line = br.readLine().trim(); while(!line.isEmpty()) { out.add(line); line = br.readLine().trim(); } return out; } public static void main(String[] argv) { String fileName = argv[0]; IntHistogram subjHist = new IntHistogram(); IntHistogram allHist = new IntHistogram(); try { BufferedReader br = new BufferedReader(new FileReader(fileName)); int pos = 0; while(true) { String line = br.readLine(); if(line == null) break; if(line.startsWith(""); readSentence(br); if(isSubjective) subjHist.add(pos); allHist.add(pos); } //System.out.println(subjHist.asSortedList()); //System.out.println(allHist.asSortedList()); for(int i = 0; i < 100; i++) { double p = (double) subjHist.getFrequency(i) / allHist.getFrequency(i); System.out.println(i + ". " + p); } } catch(Exception e) { e.printStackTrace(); } } }