java - Stanford NLP/NER - how to use extractors and classifiers? -
the demo file comes stanford's named entity recognition bundle shows examples of classifying sentences. outputs options strings such as:
"i eat apples michael , hashemite kingdom of jordan on mondays"
=>
"i eat apples <person>michael</person> , <person>jordan</person> on <date>mondays</date>"
or map of classifications per word.
is there method returns map of classification list of entities?
eg:
{ person : ["michael", "peter"] date : ["mondays"] }
here minimal bash script postprocessing :
echo "i eat apples <person>michael</person> , <person>jordan</person> on <date>mondays</date>" | grep -eo '<([^>/]*)>[^<]*' | awk -f '>' '{nes[$1]=nes[$1]","$2;} end {for(t in nes) print tolower(t)":{"nes[t]"}";}' | sed 's/:{,/:{/' | tr -d '<'
using you'll obtain lists illustration :
date:{mondays} person:{michael,jordan}
you'll want handle multiple entries ("uniq" or count them?).
java stanford-nlp named-entity-recognition named-entity-extraction
No comments:
Post a Comment