Teradata R Package Function Reference - POSTagger - Teradata R Package - Look here for syntax, methods and examples for the functions included in the Teradata R Package.

Teradata® R Package Function Reference

Product
Teradata R Package
Release Number
16.20
Published
February 2020
Language
English (United States)
Last Update
2020-02-28
dita:id
B700-4007
lifecycle
previous
Product Category
Teradata Vantage

Description

The POSTagger function creates part-of-speech (POS) tags for the words in the input text. POS tagging is the first step in the syntactic analysis of a language, and an important preprocessing step in many natural language processing applications.

Usage

  td_pos_tagger_mle (
      data = NULL,
      text.column = NULL,
      language = "en",
      accumulate = NULL,
      data.sequence.column = NULL,
      data.order.column = NULL
  )

Arguments

data

Required Argument.
Specifies the tbl_teradata that contains the input texts to tag.

data.order.column

Optional Argument.
Specifies Order By columns for data.
Values to this argument can be provided as a vector, if multiple columns are used for ordering.
Types: character OR vector of Strings (character)

text.column

Required Argument.
Specifies the name of the input column that contains the text to be tagged.
Types: character

language

Optional Argument.
Specifies the language of the input text.
Default Value: "en"
Permitted Values: en (English), zh_CN (Simplified Chinese)
Types: character

accumulate

Optional Argument.
Specifies the names of the input tbl_teradata columns to copy to the output table.
Note: If you intend to use the td_pos_tagger output tbl_teradata as input to the function "td_textchunker", then this argument must specify the input tbl_teradata columns that comprise the partition key.
Types: character OR vector of Strings (character)

data.sequence.column

Optional Argument.
Specifies the vector of column(s) that uniquely identifies each row of the input argument "data". The argument is used to ensure deterministic results for functions which produce results that vary from run to run.
Types: character OR vector of Strings (character)

Value

Function returns an object of class "td_pos_tagger_mle" which is a named list containing Teradata tbl object.
Named list member can be referenced directly with the "$" operator using name: result.

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load example data.
    loadExampleData("pos_tagger_example", "paragraphs_input")
    
    # Create remote tibble objects.
    paragraphs_input <- tbl(con, "paragraphs_input")
    
    # Example 1 - Applying POSTagger using default language 'en'.
    pos_tagger_out <- td_pos_tagger_mle(data=paragraphs_input,
                              text.column='paratext',
                              language='en',
                              accumulate='paraid')
    
    # Example 2 - This example uses output of SentenceExtractor as Input.
    td_sentence_extractor_out <- td_sentence_extractor_mle(data = paragraphs_input,
                                                       text.column = "paratext",
                                                       accumulate = c("paraid", "paratopic"))
    
    
    pos_tagger_out <- td_pos_tagger_mle(data=td_sentence_extractor_out$result,
                                    text.column='sentence',
                                    accumulate=c('sentence','sentence_sn'))