Extend Natural Language Understanding Functionality With Custom ML Models

This Is How To Enhance the IBM Watson NLU API With Watson Knowledge Studio ML Models

Introduction

Image for post
Image for post
NLU from the IBM Cloud services list.
Image for post
Image for post
IBM Watson Knowledge Studio annotation of documents.

Getting Started with IBM Watson Natural Language Understanding

Image for post
Image for post
The very simplistic NLU API console.
Image for post
Image for post
Accessing & testing the NLU API from the Postman application.
{
"text": "While I was at the Toyota dealership I got a call from Apple regarding my iPhone.",
"features": {
"entities": {
}
}
}
{
"usage": {
"text_units": 1,
"text_characters": 81,
"features": 1
},
"language": "en",
"entities": [
{
"type": "Company",
"text": "Toyota",
"relevance": 0.963296,
"disambiguation": {
"subtype": [
"Organization",
"AutomobileCompany",
"ManufacturingPlant",
"AwardWinner"
],
"name": "Toyota",
"dbpedia_resource": "http://dbpedia.org/resource/Toyota"
},
"count": 1,
"confidence": 0.999806
},
{
"type": "Company",
"text": "Apple",
"relevance": 0.376233,
"count": 1,
"confidence": 0.998934
}
]
}
{
"url": "www.url.example",
"features": {
"entities": {
"model": "your-model-id-here"
},
"relations": {
"model": "your-model-id-here"
}
}
}

Getting Started with IBM Watson Knowledge Studio

Image for post
Image for post
Uploading documentation to start creating a ML Model.
Image for post
Image for post
Process of manually annotating the document.
Image for post
Image for post
After annotating, training and evaluation can be performed.
Image for post
Image for post
Confirmation on successful ML training.
Image for post
Image for post
Deploying the Watson Knowledge Studio model.
Image for post
Image for post
Post ML Model deployment, the Model ID is created.

Example NLU API Referencing the ML Model

Vekiarides founded TwinStrata with CTO John Bates, who was previously a distinguished technologist with HP storage division and an executive at Incipient.
{
"text": "Vekiarides founded TwinStrata with CTO John Bates, who was previously a distinguished technologist with HP storage division and an executive at Incipient.",
"features": {
"entities": {
"model": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"limit": 40,
"document": false
}
}
}
{
"usage": {
"text_units": 1,
"text_characters": 154,
"features": 1
},
"language": "en",
"entities": [
{
"type": "ORGANIZATION",
"text": "HP",

"disambiguation": {
"subtype": [
"NONE"
]
},
"count": 1,
"confidence": 0.996624
},
{
"type": "PERSON",
"text": "Vekiarides",

"disambiguation": {
"subtype": [
"NONE"
]
},
"count": 1,
"confidence": 0.994682
},
{
"type": "PERSON",
"text": "John Bates",

"disambiguation": {
"subtype": [
"NONE"
]
},
"count": 1,
"confidence": 0.988645
},
{
"type": "ORGANIZATION",
"text": "TwinStrata",

"disambiguation": {
"subtype": [
"NONE"
]
},
"count": 1,
"confidence": 0.977798
},
{
"type": "ORGANIZATION",
"text": "Incipient",

"disambiguation": {
"subtype": [
"NONE"
]
},
"count": 1,
"confidence": 0.972558
},
{
"type": "TITLEWORK",
"text": "CTO",

"disambiguation": {
"subtype": [
"NONE"
]
},
"count": 1,
"confidence": 0.966713
},
{
"type": "TITLEWORK",
"text": "technologist",

"disambiguation": {
"subtype": [
"NONE"
]
},
"count": 1,
"confidence": 0.916097
}
]
}

Conclusion

Written by

NLP/NLU, Chatbots, Voice, Conversational UI/UX, CX Designer, Developer, Ubiquitous User Interfaces. www.cobusgreyling.me