Inspiration
This project was inspired by a simple fascination with the Watson API, in all of its complexity. We found that the capabilities of the Watson API were wide in scope, and incredibly responsive. We also shared a common cybersecurity interest, and endeavored to create a Watson conversation bot that could intelligently handle some aspects of a cyber investigation.
What it does
The Watson API is mostly leveraged using a LogParser Python object, which generates a running commentary of Watson's insights on the subject's emotions. Watson has a conversation workspace created with basic dialog focused on ascertaining if a user was on his (or her) computer during a given time-frame.
If the user responds negatively, Watson attempts to backtrack and apply a different emotional setting. Continued hostility (to anomalous levels) results in an email being generated for the user that is managing Watson so a separate conversation can be struck up to acquire the information.
How we built it
Watson is currently a pure-Python3 program that leverages the Watson SDK, as well as matplotlib's pyplot.
Challenges we ran into
Parsing Watson is hard! He provides a whole slew of information in JSON format, and most of the information we were looking for was deep within the JSON structure. Matplotlib also proved to be a difficult beast to handle.
Accomplishments that we're proud of
This code, specifically.
` def tone_report(self, text, tree=None): if not tree and tree != []: self.muse("acquiring tone") resp = self.tone_client.tone(text=text)
tree = resp['document_tone']
self.muse(tree)
# Check for warnings and print them if they exist.
if 'warnings' in resp and resp['warnings']:
self.muse(resp['warnings'])
if 'tone_id' in tree and 'score' in tree:
self.muse("yielding")
yield tree['tone_id'], tree['score']
for branch in tree:
if isinstance(tree[branch], list):
for twig in tree[branch]:
for name, percentage in self.tone_report(None, twig):
self.muse("recursive call")
yield name, percentage
else:
self.muse("not list")`
It allows us to recursively search through a Tone Analytics dictionary and generate tuples that directly connect each emotion to its score.
What we learned
In short, the capabilities of Watson
What's next for WatsonDetective
Built With
- ibm-watson
- matplotlib
- pyplot
- python
- watson-conversation-api
- watson-tone-analytics
Log in or sign up for Devpost to join the conversation.