Skip to content

Instantly share code, notes, and snippets.

@vthacker
Created February 3, 2015 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vthacker/90c7a82abb4a265087e6 to your computer and use it in GitHub Desktop.
Save vthacker/90c7a82abb4a265087e6 to your computer and use it in GitHub Desktop.
ParseWordNet
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);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment