Skip to content

Commit

Permalink
Debug type of tid and ftid
Browse files Browse the repository at this point in the history
  • Loading branch information
Decalogue committed Jan 25, 2018
1 parent cd852f9 commit 9c2b41b
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 151 deletions.
1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CHANGES
=======

* Debug
* 调整语义匹配算法及阈值
* 简化知识库格式
* 优化子场景匹配
Expand Down
8 changes: 6 additions & 2 deletions chat/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""Natural Language Understanding based on Machine Learning."""
"""Chat robot based on natural language understanding and machine learning."""

__name__ = 'chat'
__verison__ = '1.0.6'
__author__ = 'Decalogue'
__author_email__ = '1044908508@qq.com'
12 changes: 5 additions & 7 deletions chat/client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# PEP 8 check with Pylint
"""Chat client. 聊天客户端。
Available functions:
Expand All @@ -21,7 +19,7 @@
mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
mysock.connect(("localhost", 7000))

def question_pack(info="", userid="userid"):
def question_pack(info="", userid="A0001"):
"""Package the question as the JSON format specified by the server.
将问题打包为服务器指定的json格式。
Expand All @@ -43,7 +41,7 @@ def question_pack(info="", userid="userid"):
}
return json.dumps(data)

def config_pack(info="", userid="userid"):
def config_pack(info="", userid="A0001"):
"""Package the config info as the JSON format specified by the server.
将配置信息打包为服务器指定的json格式。
Expand All @@ -65,7 +63,7 @@ def config_pack(info="", userid="userid"):
}
return json.dumps(data)

def match(question="question", userid="userid"):
def match(question="question", userid="A0001"):
"""Match the answers from the semantic knowledge database.
从语义知识数据库搜索答案。
Expand All @@ -84,7 +82,7 @@ def match(question="question", userid="userid"):
received = received.decode("UTF-8")
return received

def config(info="", userid="userid"):
def config(info="", userid="A0001"):
"""Configure the semantic knowledge database.
配置语义知识数据库。
Expand All @@ -111,7 +109,7 @@ def start():
question = input("\n>>question=")
userid = input(">>userid=")
if not userid:
userid = "userid"
userid = "A0001"
if question == "config":
result = config(info="", userid=userid)
else:
Expand Down
9 changes: 7 additions & 2 deletions chat/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,13 @@ def handle_excel(self, filename=None, custom_sheets=[]):
# 场景 topic 必须填写,问答 topic 可不填,若填写必须为 sheet_name
temp = table.cell(i, col_index[2]).value
topic = temp if temp else sheet_name
tid = table.cell(i, col_index[3]).value
ftid = table.cell(i, col_index[4]).value

temp = table.cell(i, col_index[3]).value
tid = int(temp) if temp != '' else ''

temp = table.cell(i, col_index[4]).value
ftid = int(temp) if temp != '' else ''

behavior = table.cell(i, col_index[5]).value
parameter = table.cell(i, col_index[6]).value
url = table.cell(i, col_index[7]).value
Expand Down
2 changes: 0 additions & 2 deletions chat/mytools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python3
# -*- coding:utf8 -*-
# PEP 8 check with Pylint
"""A collection of useful tools. 实用工具集合。
Including batch processing, performance analysis, data analysis, etc..
Expand Down
Loading

0 comments on commit 9c2b41b

Please sign in to comment.