List of usage examples for edu.stanford.nlp.io IOUtils getBufferedFileReader
@Deprecated public static BufferedReader getBufferedFileReader(String filename) throws IOException
From source file:pltag.util.UndoConllHeuristics.java
License:Open Source License
public void execute() { try {//www . j a v a 2 s . com BufferedReader br = IOUtils.getBufferedFileReader(inputFilename); BufferedWriter bw = new BufferedWriter(new FileWriter(outputFilename)); String sentence = readNextSentence(br); while (!sentence.equals("")) { boolean foundInfinitiveMarker; List<List<String>> tokens = Utils.unpackConllSentenceToTokens(sentence); for (int w = 0; w < tokens.size(); w++) { List<String> wordTokens = tokens.get(w); foundInfinitiveMarker = identifyInfinitiveMarker(wordTokens); if (foundInfinitiveMarker) { undoInfinitiveMarkerHeuristic(tokens, wordTokens); } if (identifyPreposition(wordTokens, foundInfinitiveMarker)) { undoAlternativeHeadHeuristic(tokens, wordTokens); // System.out.println(wordTokens); } if (identifySubordinateConjunction(wordTokens)) { undoAlternativeHeadHeuristic(tokens, wordTokens); } } // repack conll sentence and write to output file String repackedSentence = Utils.repackConllTokensToSentence(tokens); bw.write(repackedSentence); // System.out.println(repackedSentence); sentence = readNextSentence(br); // go to the next sentence } br.close(); bw.close(); } catch (IOException ioe) { ioe.printStackTrace(); } }