Created
February 3, 2015 11:53
Revisions
-
Varun Thacker created this gist
Feb 3, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; import java.nio.file.Paths; import java.nio.file.StandardOpenOption; import java.util.ArrayList; import java.util.List; public class ParseWordNet { public static void main(String args[]) throws IOException { List<String> lines = Files.readAllLines(Paths.get(System.getProperty("inputFile")), Charset.defaultCharset()); List<String> text = new ArrayList<>(); for (String line : lines) { int start = line.indexOf('\'')+1; int end = line.lastIndexOf('\''); text.add(line.substring(start, end).replace("''", "'")); } Files.write(Paths.get(System.getProperty("outputFile")), text, Charset.defaultCharset(), StandardOpenOption.CREATE); } }