def run_robot(self, tag_tree_path, sentences_market_path, tags_path) : robot = Robot() loader = PickleMarket() file_operator = TextFileOperator() cmd_list = file_operator.reading(tag_tree_path) tag_tree = TagTree(cmd_list) sentences = loader.load_market(sentences_market_path) tags = loader.load_market(tags_path) print 'start' string = raw_input().decode('gb18030') # string = u'我想要毛衣' sentences = robot.question_and_answer(string, sentences, tags, tag_tree)
def run_convert_sentences(self, sentences_path, sentences_market_path) : file_operator = TextFileOperator() sentences = self.read_sentences(sentences_path) loader = PickleMarket() loader.dump_market(sentences, sentences_market_path)