| |
Methods defined here:
- __init__(self, data=None, text_coloumn=None, model=None, language='en', data_sequence_column=None, data_order_column=None)
- DESCRIPTION:
The NEREvaluator function evaluates a CRF model (output by the
function NERTrainer).
Note:
NEREvaluator uses below files that are preinstalled on the ML Engine:
* ner_model_1.0_reuters_en_all_141011.bin
* template_1.txt
PARAMETERS:
data:
Required Argument.
Specifies an input teradataml DataFrame containing input data.
data_order_column:
Optional Argument.
Specifies Order By columns for data.
Values to this argument can be provided as a list, if multiple
columns are used for ordering.
Types: str OR list of Strings (str)
text_coloumn:
Required Argument.
Specifies the name of the input teradataml DataFrame column that
contains the text to analyze.
Types: str
model:
Required Argument.
Specifies the CRF model file (binary file) to evaluate, generated by
"NERTrainer" function. If you specified the ExtractorJAR argument in the
NERTrainer call that generated model_file, then you must specify
the same jar_file in this argument. You must install model_file and
jar_file in ML Engine under the user search path before calling
the NEREvaluator function.
Note:
1. The names of model_file and jar_file are case-sensitive.
2. For JAR files installation instructions, see Teradata Vantage User Guide.
Types: str
language:
Optional Argument.
Specifies the language of the input text:
* en - English
* zh_CN - Simplified Chinese
* zh_TW - Traditional Chinese
Default Value: "en"
Types: str
data_sequence_column:
Optional Argument.
Specifies the list 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: str OR list of Strings (str)
RETURNS:
Instance of NEREvaluator.
Output teradataml DataFrames can be accessed using attribute
references, such as NEREvaluatorObj.<attribute_name>.
Output teradataml DataFrame attribute name is:
result
RAISES:
TeradataMlException
EXAMPLES:
# Before running NEREvaluator, run NERTrainer to generate model file.
# Load the data to run the NERTrainer example.
load_example_data("nertrainer","ner_sports_train")
# Create teradataml DataFrame object.
ner_sports_train = DataFrame.from_table("ner_sports_train")
# Run the train function to generate model file for NEREvaluator function.
nertrainer_train = NERTrainer(data=ner_sports_train,
text_coloumn='content',
model_file='ner_model.bin',
feature_template='template_1.txt'
)
# Print the result DataFrame.
print(nertrainer_train.result)
# NEREvaluator
# Example - Run evaluator function to evaluate a CRF model (generated by NERTrainer)
# Load the data to run the example.
load_example_data("nerevaluator", "ner_sports_test2")
# Create teradataml DataFrame object.
ner_sports_test2 = DataFrame.from_table("ner_sports_test2")
# Run the evaluator function using rules entity.
nerevaluator_out = NEREvaluator(data=ner_sports_test2,
text_coloumn='content',
model='ner_model.bin',
language='en',
data_sequence_column='id'
)
# Print the result DataFrame.
print(nerevaluator_out.result)
- __repr__(self)
- Returns the string representation for a NEREvaluator class instance.
|