Teradata R Package Function Reference - 16.20 - NamedEntityFinderTrainer - Teradata R Package

Teradata® R Package Function Reference

prodname
Teradata R Package
vrm_release
16.20
created_date
February 2020
category
Programming Reference
featnum
B700-4007-098K

Description

The NamedEntityFinderTrainer (td_namedentity_finder_trainer_mle) function takes training data and outputs a Max Entropy data model. The function is based on OpenNLP, and follows its annotation. For more information on OpenNLP, see http://opennlp.apache.org/documentation/1.5.2-incubating/manual/opennlp.html.

Usage

  td_namedentity_finder_trainer_mle (
      data = NULL,
      text.column = NULL,
      entity.type = NULL,
      model.file = NULL,
      iter.num = 100,
      cutoff = 5,
      data.sequence.column = NULL
  )

Arguments

data

Required Argument.
Specifies the input tbl_teradata containing the text column to train.

text.column

Required Argument.
Specifies the name of the input tbl_teradata column that contains the text to analyze.

entity.type

Required Argument.
Specifies the entity type to be trained (for example, LOCATION). The input training documents must contain the same tag.

model.file

Required Argument.
Specifies the name of the data model file to be generated.
Note: If a file with the same name exists, then it will be overwritten.

iter.num

Optional Argument.
Specifies the iterator number for training (an openNLP training parameter).
Default Value: 100

cutoff

Optional Argument.
Specifies the cutoff number for training (an openNLP training parameter).
Default Value: 5

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.

Value

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

Examples

    # Get the current context/connection
    con <- td_get_context()$connection
    
    # Load example data.
    loadExampleData("namedentityfindertrainer_example", "nermem_sports_train")
    
    # Create remote tibble objects.
    nermem_sports_train <- tbl(con, "nermem_sports_train")
    
    # Example: Train a namedentity finder model on entity type: "LOCATION"
    # The trained model is stored in a binary file: "location.sports"
    td_neft_out <- td_namedentity_finder_trainer_mle(data = nermem_sports_train,
                                                 text.column = "content",
                                                 entity.type = "LOCATION",
                                                 model.file = "location.sports"
                                                )