Skip to content

Instantly share code, notes, and snippets.

@AmirHooshangi
Last active August 29, 2015 14:08
Show Gist options
  • Save AmirHooshangi/ed3c012e22fa6d670f0f to your computer and use it in GitHub Desktop.
Save AmirHooshangi/ed3c012e22fa6d670f0f to your computer and use it in GitHub Desktop.
def recursiveTypefinder(parse: opennlp.tools.parser.Parse): String = {
/*
* TODO: CHECKING ONE OR TWO WORDS NP's
*/
if (parse.getType().equals("NN") || parse.getType().equals("JJ")
|| parse.getType().equals("NNS")
|| parse.getType().equals("NNP")) {
return parse.getCoveredText
}
for (child <- parse.getChildren) {
recursiveTypefinder(child)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment