I am trying to extract names of people from the text using OpenNLP in R. However whenever I use Indian names, the model fails to detect the names. Hence I understood that I need to build custom model. I have built my own en-ner-customperson.bin
using Java.
I am not understanding how should I use this custom model in my R code?
I am using the following code:
require("NLP")
## Some text.
s <- paste(c("Hardik, 61 years old, will join the board as a ",
"nonexecutive director Nov. 29.\n",
"Mr. Vinken is chairman of Elsevier N.V., ",
"the Dutch publishing group."),
collapse = "")
s <- as.String(s)
## Need sentence and word token annotations.
sent_token_annotator <- Maxent_Sent_Token_Annotator()
word_token_annotator <- Maxent_Word_Token_Annotator()
a2 <- annotate(s, list(sent_token_annotator, word_token_annotator))
## Entity recognition for persons.
entity_annotator <- Maxent_Entity_Annotator()
entity_annotator
annotate(s, entity_annotator, a2)
## Directly:
entity_annotator(s, a2)
## And slice ...
s[entity_annotator(s, a2)]
## Variant with sentence probabilities as features.
annotate(s, Maxent_Entity_Annotator(probs = TRUE), a2)
Is there any documentation available to build custom models in R? How to build custom models and use them along with R