get-functions: get functions for spaCy

get-functionsR Documentation

get functions for spaCy

Description

A collection of get methods for spacyr return objects (of spacy_out class).

Usage

get_tokens(spacy_out)

get_tags(spacy_out, tagset = c("google", "detailed"))

get_attrs(spacy_out, attr_name, deal_utf8 = FALSE)

get_named_entities(spacy_out)

get_dependency(spacy_out)

get_noun_phrases(spacy_out)

get_ntokens(spacy_out)

get_ntokens_by_sent(spacy_out)

Arguments

spacy_out

a spacy_out object

tagset

character label for the tagset to use, either "google" or "detailed" to use the simplified Google tagset, or the more detailed scheme from the Penn Treebank (or the German Text Archive in case of German language model).

attr_name

name of spaCy token attributes to extract

Value

get_tokens returns a data.frame of tokens from spaCy.

get_tags returns a tokenized text object with part-of-speech tags. Options exist for using either the Google or Detailed tagsets. See https://spacy.io.

get_attrs returns a list of attributes from spaCy output

get_named_entities returns a list of named entities in texts

get_dependency returns a data.frame of dependency relations.

get_noun_phrases returns a data.frame of noun phrases.

get_ntokens returns a data.frame of dependency relations

get_ntokens_by_sent returns a data.frame of dependency relations, by sentence

Examples

## Not run: 
# get_tags examples
txt <- c(text1 = "This is the first sentence.\nHere is the second sentence.", 
         text2 = "This is the second document.")
results <- spacy_parse(txt)
tokens <- tokens(results)
tokens_with_tag <- tokens_tag(tokens)


## End(Not run)

kbenoit/spacyr documentation built on April 14, 2024, 3:03 a.m.