Description Usage Arguments Details Value See Also Examples
Generate an annotator which computes entity annotations using the Apache OpenNLP Maxent name finder.
1 2 | Maxent_Entity_Annotator(language = "en", kind = "person", probs = FALSE,
model = NULL)
|
language |
a character string giving the ISO-639 code of the language being processed by the annotator. |
kind |
a character string giving the ‘kind’ of entity to be annotated (person, date, ...). |
probs |
a logical indicating whether the computed annotations should provide the token probabilities obtained from the Maxent model as their ‘prob’ feature. |
model |
a character string giving the path to the Maxent model file to be
used, or |
See http://opennlp.sourceforge.net/models-1.5/ for available model files. These can conveniently be made available to R by installing the respective openNLPmodels.language package from the repository at https://datacube.wu.ac.at.
An Annotator
object giving the generated entity
annotator.
https://opennlp.apache.org for more information about Apache OpenNLP.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ## Requires package 'openNLPmodels.en' from the repository at
## <https://datacube.wu.ac.at>.
require("NLP")
## Some text.
s <- paste(c("Pierre Vinken, 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.