Package com.tietoenator.trip.jxp.data
Class TdbNlpInfo
java.lang.Object
com.tietoenator.trip.jxp.data.TdbNlpInfo
Container for natural language processing information.
Access to instances of this class is provided via properties in the
TdbRecord class. Use this class to enable TRIPcof/TRIPnlp keyword and metadata
extraction from fields in the record.
You will need TRIPsystem 7.0 or later and TRIPcof on the server in order to make use of this class. You also need TRIPnlp or a custom NLP adapter for TRIPcof installed together with TRIPcof.
- Since:
- TRIPjxp 3.0-1
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Field name mapping mode for extracted meta-data. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addInputField
(String name) Add the name of a field on which to base meta-data processing.boolean
Returns true if keywords are to be extracted and false otherwise.boolean
Returns true if meta-data is to be extracted and false otherwise.boolean
Get state of fallback behavior.Get the field name mapping mode to control how extracted meta-data is stored into the record.Get the name of the field to receive extracted keywords.Get the name of the tupled field to receive extracted meta-data names.Get the name of the tupled field to receive extracted meta-data values.Get the ID of the adapter that must be used to perform the analysis.boolean
Returns true if TRIPcof/TRIPnlp interaction is enabled and false otherwise.void
mapMetadataField
(String categoryName, String fieldName) Define a field to hold the values for a particular meta-data category.void
setExtractKeywords
(boolean enable) Enable or disable the extraction of keywords.void
setExtractMetadata
(boolean enable) Enable or disable the extraction of meta-data.void
setFallback
(boolean enable) Enable or disable fallback behavior.void
Set the field name mapping mode to control how extracted meta-data is stored into the record.void
setInputLanguage
(int lang) Sets the input language of the text in the record to be analyzed.void
setInputLanguage
(TdbLanguage lang) Sets the input language of the text in the record to be analyzed.void
setInputLanguage
(String lang) Sets the input language of the text in the record to be analyzed.void
setKeywordField
(String fieldname) Set the name of the field to receive extracted keywords.void
setMetadataTupleFields
(String namefield, String valuefield) Set the names of the field to receive extracted meta-data.void
setPreferredAdapter
(String adapterid) Assign the ID of the adapter that must be used to perform the analysis.
-
Method Details
-
isEnabled
public boolean isEnabled()Returns true if TRIPcof/TRIPnlp interaction is enabled and false otherwise. TRIPcof/TRIPnlp interaction is enabled if either keywords or meta-data extraction has been enabled. -
setExtractKeywords
public void setExtractKeywords(boolean enable) Enable or disable the extraction of keywords.- Parameters:
enable
- True to enable and false to disable
-
getExtractKeywords
public boolean getExtractKeywords()Returns true if keywords are to be extracted and false otherwise. -
setExtractMetadata
public void setExtractMetadata(boolean enable) Enable or disable the extraction of meta-data.- Parameters:
enable
- True to enable and false to disable
-
getExtractMetadata
public boolean getExtractMetadata()Returns true if meta-data is to be extracted and false otherwise. -
setInputLanguage
public void setInputLanguage(int lang) Sets the input language of the text in the record to be analyzed. Input language should be declared if the database design does not include a natural language specification.- Parameters:
lang
- TRIP numerical code of language.
-
setInputLanguage
Sets the input language of the text in the record to be analyzed. Input language should be declared if the database design does not include a natural language specification.- Parameters:
lang
- Natural language type string (ENG, GER, SWE, NOR, FIN, or CHI)
-
setInputLanguage
Sets the input language of the text in the record to be analyzed. Input language should be declared if the database design does not include a natural language specification.- Parameters:
lang
- Enumerated value representing the language of the text
-
setFieldMapping
Set the field name mapping mode to control how extracted meta-data is stored into the record.- Parameters:
type
- Mapping type to assign
-
getFieldMapping
Get the field name mapping mode to control how extracted meta-data is stored into the record.- Returns:
- Field name mapping used with meta-data extraction
-
setPreferredAdapter
Assign the ID of the adapter that must be used to perform the analysis. If not set, any suitable one installed on the server will be used.- Parameters:
adapterid
- ID of the TRIPcof NLP adapter to use
-
getPreferredAdapter
Get the ID of the adapter that must be used to perform the analysis.- Returns:
- Preferred adapter or an empty string if not set.
-
setFallback
public void setFallback(boolean enable) Enable or disable fallback behavior. If fallback is enabled and processing fails using one adapter, TRIPcof will attempt to use other NLP adapters if any are available.- Parameters:
enable
- True to enable fallback behavior and false to disable.
-
getFallback
public boolean getFallback()Get state of fallback behavior. If fallback is enabled and processing fails using one adapter, TRIPcof will attempt to use other NLP adapters if any are available.- Returns:
- True if fallback is enabled and false otherwise.
-
setKeywordField
Set the name of the field to receive extracted keywords.- Parameters:
fieldname
- Name of phrase field- Throws:
TdbException
- If field does not exist in the database or is not a phrase field.
-
getKeywordField
Get the name of the field to receive extracted keywords.- Returns:
- Phrase field name or empty string if no field is defined.
-
setMetadataTupleFields
Set the names of the field to receive extracted meta-data. The field mapping must be set to FieldMappingType.Tuples if these field names are to be considered by TRIPcof.- Parameters:
namefield
- Name of phrase field to hold meta-data category namesvaluefield
- Name of phrase field to hold meta-data category values- Throws:
TdbException
- If either field does not exist in the database or is not a phrase field.
-
getMetadataNameField
Get the name of the tupled field to receive extracted meta-data names.- Returns:
- Phrase field name or empty string if no field is defined.
-
getMetadataValueField
Get the name of the tupled field to receive extracted meta-data values.- Returns:
- Phrase field name or empty string if no field is defined.
-
mapMetadataField
Define a field to hold the values for a particular meta-data category. Please refer to TRIPnlp documentation for valid category names. The field mapping must be set to FieldMappingType.Fields if this information is to be considered by TRIPnlp.- Parameters:
categoryName
- Name of meta-data categoryfieldName
- Field to hold the values of the category- Throws:
TdbException
- If field does not exist in the database or is not a phrase field.
-
addInputField
Add the name of a field on which to base meta-data processing. The aggregated value of several fields can be used.- Parameters:
name
- Name of TEXT or PHRASE field from which to get text to analyze.- Throws:
TdbException
- If field does not exist in the database or is not of type phrase or text.
-