Skip to content

Instantly share code, notes, and snippets.

@ettorerizza
Created July 2, 2017 17:04
Show Gist options
  • Save ettorerizza/058cb462a684230ee5a48dddf8fb6129 to your computer and use it in GitHub Desktop.
Save ettorerizza/058cb462a684230ee5a48dddf8fb6129 to your computer and use it in GitHub Desktop.
OpenRefine/jython POS tagging with parsetree
import sys
sys.path.append(r'D:\jython2.7.0\Lib\site-packages')
from pattern.fr import parsetree
sentences = parsetree(value, relations=True, lemmata=True)
liste = []
for s in sentences:
for chunk in s.chunks:
for w in chunk.words:
if w.type=="NNP":
liste.append(chunk.string)
return ":::".join(liste)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment