hp_spacyr: Create a hierplane object using spacyr

Description Usage Arguments Details Examples

View source: R/hp_spacyr.R

Description

Creating a hierplane object from text is made possible by employing the spacyr package. More specifically, the spacyr::spacy_parse() function is used to tokenize and tag the sentence(s) provided. Note that this functionality requires the spacyr package.

Usage

1
2
3
4
5
6
7
8
hp_spacyr(
  .data,
  node_type = "dep_",
  link = "dep_",
  attributes = spacyr_default_attributes(),
  styles = NULL,
  ...
)

Arguments

.data

A sentence.

node_type

spacyr::spacy_parse() variable to be used as node type (used for plane styling).

link

spacyr::spacy_parse() variable to be used to generate lane tags (i.e. connections between planes).

attributes

spacyr::spacy_parse() variable(s) to be used for generating the attribute tags. See full list of available attributes here:

styles

Assign styles to hierplane.

...

Additional parameters to pass to spacyr::spacy_parse()

Details

If more than one sentence is detected in the input text, a list of hierplane objects is returned.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
if (FALSE) {

  # Custom attribute tags
  hp_spacyr("A house cat is genetically 95.6% tiger.", attributes = c("pos", "is_stop")) %>%
    hierplane()

  # Multiple sentences in input
  hp_spacyr("I have a cat. Her name is Mocha. She has a round belly.") %>%
    lapply(hierplane)

}

r4fun/hierplane documentation built on Aug. 1, 2020, 9:48 a.m.