Teradata R Package Function Reference | 17.00 - 17.00 - POSTagger - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
17.00
created_date
September 2020
category
Programming Reference
featnum
B700-4007-090K

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.
Permitted Values: en (English), zh_CN (Simplified Chinese)
Default Value: "en"
Types: character

accumulate

Optional Argument.
Specifies the names of the input tbl_teradata columns to copy to the output tbl_teradata.
Note: If you intend to use the function output tbl_teradata as input to the function TextChunker (td_textchunker_mle), 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 object of class "tbl_teradata".
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 object(s) of class "tbl_teradata".
    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 td_sentence_extractor_mle() function 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')
                                       )