Migrating text analysis rules
You can use the IBM Watson® Explorer oneWEX REST API to migrate IBM Watson Explorer Analytical Components text analysis rules to a Watson™ Explorer oneWEX dictionary annotator.
You cannot edit migrated text analysis rules in Watson Explorer oneWEX. To make changes, you must edit the text analysis rules in Watson Explorer Analytical Components and redo the migration.
Get the Watson Explorer Analytical Components text analysis rules
Text analysis rules are stored in the Watson Explorer Analytical Components master server. The folder path is $ES_NODE_ROOT/master_config/<collection_id>.indexservice/resource/pattern. The category tree file is stored at $ES_NODE_ROOT/master_config/<collection_id>.indexservice. The file name is category_tree.xml.
Migrate the text analysis rules to Watson Explorer oneWEX
These instruction use the swagger interface to submit REST API calls to Watson Explorer oneWEX.
- Go to https://<wexONE_server>/docs/. Click Authorize and enter your signin credentials. Click Authorize and then click Done.
- Open the text analysis rules file in a text editor.
- Find the
mi
element, remove the first instance of$
, and then save the file. For example, change<mi category="$.food_keywords.change_of_properties" value="${0.lex} ${1.lex}"> <w id="0" str="cloudy" /> <w id="1" pos="noun" str="/(white|yellow)/"/> </mi>
to
<mi category=".food_keywords.change_of_properties" value="${0.lex} ${1.lex}"> <w id="0" str="cloudy" /> <w id="1" pos="noun" str="/(white|yellow)/"/> </mi>
- Open Try it out. . Click
- Update the body as shown below. Choose values for
<rule_description>
and<rule_name>
.{ "description": "<rule_description>", "id": "string", "metadata": { "lastModified": 1531288825136 }, "name": "<rule_name>", "tags": { }, "type": "tpat" }
- Click Execute and confirm the server response code. is
200
. - Copy the value of the
id
field in the Response body. - Open Try it out. . Click
- Enter the
id
from step 7 and click Choose File to browse to the file you created in step 3. - Click Execute and confirm the server response code is
200
.
Migrate the Watson Explorer Analytical Components category tree file
- Open Try it out. . Click
- Paste the contents of the category tree file into the body field.
- Click Execute and confirm the server response code is
200
. - Copy the contents of Response body into a file and save it as a JSON file. For example, migrated_tree.json.
Create enrichment
- Open Try it out. . Click
- Update the body field as shown below.
<enrichment_name>
and<enrichment_description>
are the enrichment name and description that you choose.<contents_of_category tree_file>
is the entire content of the category tree file. ThefileResources
element contains theid
values of the text analysis rules that you migrated.<enrichment_name>
and<enrichment_description>
are the enrichment name and description that you choose.<contents_of_migrated_category tree_file>
is the entire content of the migrated category tree file.- The
fileResources
element contains theid
values of the text analysis rules that you migrated.
{ "name": "<enrichment_name>", "description": "<enrichment_description>", "metadata": { "lastModified": 1532479085299 }, "tags": { "depends-on": "pos" }, "type": "dict", "fileResources": [ "<resource_id1>", "<resource_id2>" ], "category": { <contents_of_migrated_category tree_file> }, "annotationIndexingSpecs": null, "facetDictionaries": [], "labelerId": null, "modelId": null }
- Click Execute and confirm the server response code is
200
. - Go to the Resources page of the Watson Explorer oneWEX Admin Console and verify the annotator has been added.