Created
August 11, 2017 08:45
-
-
Save fmarten/f2ae648e3ccca9f3e2584d8d675d653c to your computer and use it in GitHub Desktop.
Extract dependencies from conll file
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
#!/usr/bin/env scalas | |
/*** | |
scalaVersion := "2.11.8" | |
resolvers ++= Seq( | |
"Will's bintray" at "https://dl.bintray.com/willb/maven/", | |
"jitpack" at "https://jitpack.io" | |
) | |
libraryDependencies ++= Seq( | |
"com.github.fmarten" % "scala-conll-format" % "-SNAPSHOT" | |
) | |
*/ | |
val path = "/tmp/conll.csv" | |
new java.io.PrintWriter(path) { | |
write("""# parser = MaltParser Language: English. Parser configuration: Stack. Transition system: Projective. Model: de.tudarmstadt.ukp.dkpro.core.maltparser-upstream-parser-en-linear. Model version: 20120312. | |
# text = Website Usability Tips, Tricks and Mistakes. | |
0 Website Website NNP NNP 2 nn 2:nn O | |
1 Usability Usability NNP NNP 2 nn 2:nn O | |
2 Tips Tips NNP NNP 2 ROOT 2:ROOT O | |
""") | |
close() | |
} | |
import de.tudarmstadt.conll._ | |
val reader = CoNLLFileReader.open(path) | |
val sentence = reader.nextSentence() | |
println(sentence.rows.mkString("\n")) | |
// TODO extract deps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment