ExtractTextNLP
The action calls the Natural Language Processing (NLP) API and passes in text from a single page at a time. The results are saved as entities in the page's layout XML file. Use the FindExtractedText action to populate fields with results of this action. To extract from non-English-language text, set the page variablehr_locale to the wanted language before calling this action. For example, for the Japanese language, call rrset("ja","@P.hr_locale").
Syntax
bool ExtractTextNLP (string options, string model)
Parameter text features
No parameter - returns all results
- entities
- keywords
- categories
- concepts
- semantic_roles
- relations
Variables
- Timeout
- The default timeout is 150 seconds. You can specify the timeout by saving a page variable called nlpTimeout and specifying the time in milliseconds.
- Save Response
- The response from NLPAPI can be saved by setting the variable nlpSaveResponse to 1.
Returns
True if the layout is loaded and there are no errors. Otherwise, False.Level
Document or page.Details
- Save the URL in your application's general section in a variable called NLPApiUrl.Note: If the NLPApiUrl is not updated, the default URL is https://gateway.watsonplatform.net/natural-language-understanding/api/v1/analyze?version=2017-02-27
- Save the username in your application's gen section in a variable called NLPApiUsername.
- Save the password in your application's adv section in a variable called NLPApiPassword.
You can deploy Watson Knowledge Studio custom model to override default model.
Entities are named by using the format NLPFeature.ResponseNode. For example, an entity result for a person has the name Entity.Person. Most entity fields are named by using the node returned by NLPAPI. Nested responses are flattened to one level. For example, the disambiguated sub type is named subTypes and the results are saved as a comma-separated list.When called on the document or page, the text of the layout XML file specified in the calling object's layout variable will be sent to NLPAPI.
The results will be saved to the entities list of the page in the layout XML file.
To populate a field with a result of this action, use the FindExtractedText action.
Example
Recognize()
AnalyzeLayout()
ExtractTextNLP()
FindExtractedText()