wkstools - A little helper for IBM Watson Natural Language Understanding with Watson Knowledge Studio

wkstools is a small convenience library that provides utilities to efficiently work with entities and relations provided by IBM Natural Language Understanding.

# Intro

Working with IBM Watson Knowledge Studio and IBM Natural Language Understanding (NLU) can be complicated, especially when relying on complex entity and relationship structures. Therefore, I created wkstools as a simple wrappe to work with the data provided by NLU.

wkstools is essentially a convenience library that bridges the gap between raw NLU outputs and actionable data insights. Its primary function is to provide a set of utilities that make it easier to parse, interpret, and utilize entities and relations generated by IBM Watson NLU, aiming to reduce the overhead involved in manually sifting through JSON data.

# Usage

Getting started with wkstools is straightforward. The library requires Python 3.6+ and Pydantic, ensuring a wide compatibility range. Installation is a breeze via pip, and the documentation provides clear examples of how to parse entities and relations from NLU JSON responses. This practical approach allows developers to quickly integrate wkstools into their projects, focusing more on leveraging NLU insights and less on data preprocessing.

# Installation

1
$ pip install wkstools

# Example: Parse entities and relations

To parse the NLU JSON response retrieved from IBM Natural Language Understanding, use:

1
2
3
4
5
6
7
import wkstools

# Your NLU JSON response to process
nlu_response = '{..., "relations": [{"type": "specifiesValue", ...], "entities": [...]}' 

entities = wkstools.parse_entities(nlu_response)
relations = wkstools.parse_relations(nlu_response)

See the entity and relation models for available fields.

# Example: Access specfic relations

1
2
3
4
5
6
7
8
import wkstools

# Your NLU JSON response to process
nlu_response = '{..., "relations": [{"type": "specifiesValue", ...], "entities": [...]}' 

relations = wkstools.parse_relations(nlu_response)

value_relations = wkstools.get_relations_by_type(relations, "specifiesValue")

# Further information

For those interested in diving deeper or integrating wkstools into their own projects, my GitHub repository offers comprehensive guidance, from installation instructions to detailed usage examples. You can explore the repository, contribute, or simply learn more about how wkstools can enhance your NLU projects by visiting wkstools on GitHub.

Licensed under CC BY-NC-SA 4.0
Last updated on Aug 09, 2020 00:00 UTC
Disclaimer: The postings on this site are my own and don't necessarily represent IBM's positions, strategies or opinions.
Built with Hugo
Theme Stack designed by Jimmy