Teradata Package for R Function Reference | 17.00 - 17.00 - SentenceExtractor - Teradata Package for R

Teradata® Package for R Function Reference

Product
Teradata Package for R
Release Number
17.00
Published
July 2021
Last Update
August 2022
Content Type
Programming Reference
Publication ID
B700-4007-090K
Language
English (United States)
Last Update
2022-08-19
SentenceExtractor

Description

The SentenceExtractor function extracts sentences from English input text. A sentence ends with a punctuation mark such as period (.), question mark (?), or exclamation mark (!).

Usage

  td_sentence_extractor_mle (
      data = NULL,
      text.column = NULL,
      accumulate = NULL,
      data.sequence.column = NULL,
      data.order.column = NULL
  )

Arguments

data

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

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 from which to extract sentences.
Types: character

accumulate

Optional Argument.
Specifies the names of the input columns to copy to the output tbl_teradata.
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_sentence_extractor_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("sentenceextractor_example", "paragraphs_input")
    
    # Create object(s) of class "tbl_teradata".
    paragraphs_input <- tbl(con, "paragraphs_input")
    
    # Example 1 - Extract sentences in the column named 'paratext'.
    td_sentence_extractor_out <- td_sentence_extractor_mle(data = paragraphs_input,
                                                       text.column = "paratext",
                                                       accumulate = c("paraid", "paratopic")
                                                       )