● : Provides a method (wrapper) to get the sentiment score using the Text-Analysis API.● : Frontend web client for the chat (uses Web Sockets). You can start chatting (after satisfying the prerequisites and configuring the API keys in api_key.py) by running the chat server by running “python server.py” on your terminal. Say “hi” to the bot and it should say “I don’t understand”.
Going back to our generate Reply method, we use the sentiment score to produce a reply.If the bot doesn’t respond, it may mean that there is an error in your Python code or that the Web Socket connection was unsuccessful.If you want to skip to the end results without doing the tutorial, in line 2 of server.py, rename generate_reply to generate_reply_completed.To do this, we again use the help of our slave, Microsoft’s Cognitive Services! This API allows you to explore the structure of the text and access its POS (Parts Of Speech) tagging – which labels each word in a given text with a POS (e.g. Don’t worry if this sounds complicated for now, you will get it soon enough.Looking at the Python code sample for this API, we create a simple wrapper, taking in chat input and returning the input tokenized and POS tagged.
Change it back before continuing with the tutorial.