View source: R/spacy_extract_entity.R
spacy_extract_entity | R Documentation |
This function extracts named entities from texts, based on the entity tag
ent
attributes of documents objects parsed by spaCy (see
https://spacy.io/usage/linguistic-features#section-named-entities).
spacy_extract_entity(
x,
output = c("data.frame", "list"),
type = c("all", "named", "extended"),
multithread = TRUE,
...
)
x |
a character object or a TIF-compliant corpus data.frame (see https://github.com/ropenscilabs/tif) |
output |
type of returned object, either |
type |
type of named entities, either |
multithread |
logical; If |
... |
unused |
When the option output = "data.frame"
is selected, the
function returns a data.frame
with the following fields.
text
contents of entity
entity_type
type of entity (e.g. ORG
for
organizations)
start_id
serial number ID of starting token.
This number corresponds with the number of data.frame
returned from
spacy_tokenize(x)
with default options.
length
number
of words (tokens) included in a named entity (e.g. for an entity, "New York
Stock Exchange"", length = 4
)
either a list
or data.frame
of tokens
## Not run:
spacy_initialize()
txt <- c(doc1 = "The Supreme Court is located in Washington D.C.",
doc2 = "Paul earned a postgraduate degree from MIT.")
spacy_extract_entity(txt)
spacy_extract_entity(txt, output = "list")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.