get-functions: get functions for spaCy

Description Usage Arguments Value Examples

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
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 http://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

1
2
3
4
5
6
# 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)

spacyr documentation built on July 4, 2019, 5:05 p.m.