nltk-trainer

How to integrate the sentiment analysis script with the chatbot for analysing the user's reply in the same console screen?

给你一囗甜甜゛ 提交于 2020-01-16 08:19:31
问题 I want to make a chatbot that uses Sentiment analyser script for knowing the sentiment of the user's reply for which I have completed the Chatbot making. Now only thing I want to do is to use this Script to analyse the reply of user using the chatbot that I have made. How should I integrate this sentiment_analysis.py script with the chatbot.py file to analyse the sentiment's of user? Update: The overall performance will be like this : Chatbot: How was your day? User: It was an awesome day. I

How to get a node in a tree by its label in nltk python?

天大地大妈咪最大 提交于 2019-12-01 11:23:33
I have a tree: (S (WH-QUERY Which) (FLIGHT-NP (FLIGHT-CNP (FLIGHT-CNP (FLIGHT-N flight)) (FLIGHT-DEST to (CITY-NP (CITY-NAME Hue) (CITY-N city))))) (FLIGHT-VP (FLIGHT-V arrives) (FLIGHT-TIME (P-TIME at) (TIME-MOD 20:00HR)))) I want to get a specific node by its label in nltk. For example, I have label "CITY-NAME", and I want to get the node (CITY-NAM Hue). How can I achieve this? One way to do it is to walk the tree searching for nodes that match: for subtree in tree.subtrees(): if subtree.label() == 'CITY-NAME': print subtree.leaves() Look at the _get_node method in the function. http://www

How to get a node in a tree by its label in nltk python?

时光总嘲笑我的痴心妄想 提交于 2019-12-01 07:29:50
问题 I have a tree: (S (WH-QUERY Which) (FLIGHT-NP (FLIGHT-CNP (FLIGHT-CNP (FLIGHT-N flight)) (FLIGHT-DEST to (CITY-NP (CITY-NAME Hue) (CITY-N city))))) (FLIGHT-VP (FLIGHT-V arrives) (FLIGHT-TIME (P-TIME at) (TIME-MOD 20:00HR)))) I want to get a specific node by its label in nltk. For example, I have label "CITY-NAME", and I want to get the node (CITY-NAM Hue). How can I achieve this? 回答1: One way to do it is to walk the tree searching for nodes that match: for subtree in tree.subtrees(): if