Learn R Programming

textTools (version 0.1.0)

label_parts_of_speech: Add a column with the parts of speech for each word in a text.table

Description

Add a column with the parts of speech for each word in a text.table

Usage

label_parts_of_speech(x, text)

Arguments

x

A text.table created by as.text.table().

text

A string, the name of the column in x to label the parts of speech.

Value

A text.table, with columns added for the matching part of speech and for flagging if the part of speech is for a multi-word phrase.

Examples

Run this code
# NOT RUN {
label_parts_of_speech(
as.text.table(
  x = as.data.table(
    list(
      col1 = c(
        "a",
        "b"
      ),
      col2 = c(
        tolower("The dog is nice because it picked up the newspaper."),
        tolower("The dog is extremely nice because it does the dishes.")
      )
    )
  ),
  text = "col2",
  split = " "
),
text = "col2"
)
# }

Run the code above in your browser using DataLab