Created
February 3, 2015 11:53
-
-
Save vthacker/90c7a82abb4a265087e6 to your computer and use it in GitHub Desktop.
ParseWordNet
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 characters
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