-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
convert_unicode on the String type #890
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be merged, Fixed my issue.
The character set UTF-8 |
Default encoding is UTF-8 http://docs.sqlalchemy.org/en/latest/core/engines.html#sqlalchemy.create_engine.params.encoding I have trained with Chinese corpus it worked very well sqlite> .read db.sqlite3
��compleid INTEGER NOT NULL, 3�
text VARCHAR,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
occurrence INTEGER,
statement_text VARCHAR,
PRIMARY KEY (id),
FOREIGN KEY(statement_text) REFERENCES "StatementTable" (text)
)�'��))�� tableStatementTableStatementTable�CREATE TABLE "StatementTable" (
id INTEGER NOT NULL,
text VARCHAR,
extra_data BLOB,
PRIMARY KEY (id),
UNIQUE (text)
�017-07-31 08:53:45是的,我有个问题.5?��9�你是个机器人吗?0��-07-31 08:53:45你好9��31 08:53:45很抱歉,我没有.B
�'3 �我还不错.2017-07-31 08:53:45那很好0�D���看得出来.B����喜欢什么颜色?2017-07-31 08:53:45蓝色?���闻?3��Q��么书?�����还不错,你呢?������吗?�����好����的,你呢�����������蛋糕很美味啊.������这仅仅是问一个戴面具的人的矛盾性质. 请告诉我,你喜欢音乐吗?�����美味的东西?2017-07-31 08:53:45没了N%���全疯了。但我会告诉你一个秘密。所有最棒的人都是.J ��仅仅是问一个戴面具的人的矛盾性质. 请告诉我,你喜欢音乐吗?2017-07-31 08:53:45我喜欢电影.
��-�仙女座星系.�美胜于丑陋.;,�]�但不假思索就动手还不如不做.I"�I�你似乎很熟悉Python之禅9��?�你使用什么语言呢?P��9�你听到新闻了吗?���9�你喜欢什么食物?_��9�你喜欢哪类电影?"��-�你在作什么?''�什么问题?
���你好��!�你好吗?��-�你如何运作?4Q��%�你完全疯了。但我会告诉你一个秘密。所有最棒的人都是.%��9�你想了解些什么?/��9�你想了解哪方面?3��?�你是一个程序员吗?N
�你最喜欢什么颜色?���+�你爱我吗?i��=�你的爱好是什么?a#�K�你知道它的所有内容吗?:��'�你还好吗?y��9�做也许好过不做.H��1�其他东西也行-@����凯尔特陆棚,是什么大陆的大陆架的一部分?��如何定义生活Z��3�可读性很重要.@1�g�吃喝睡 还有旅行。 你喜欢旅行吗?bC�� �命名空间是一种绝妙的理念.我们应当多加利用.Ln��]�哈勃太空望远镜,于1990年发射进入近地轨道,它是以什么美国天文学家命名的?���喜欢c���嗨k��?�嗨,很高兴见到你.|��3�嗨,最近如何?3:46我不怎么喜欢 Java.SM��的。你呢?�������L�����%食物?2017-07-31 08:53:46海鲜。鲜得我不要不要的。你呢?EV����蓝色�:�y�虽然这并不容易,因为你不是 Python 之父.G��9�蛋糕是一个谎言.)*�Y�谁? 谁只是代表了一个人罢了�
���挺好的o��9���早上好,你好吗?��3�明了胜于晦涩.< 08:53:46挺好的2b��什么���挺好n棱两可,拒绝猜测的诱惑.8
���是啊
���是啊.
���是的.1��?�是的,我有个问题.
���欢迎!l
y:53:46不怎么的-r��它的转轴方向,不受倾斜和旋转的影响,它叫什么?��������国歌?2017-07-31 08:53:47大不列颠联合王国T}�,它叫什么?2017-07-31 08:53:46陀螺.容和理解。h
��呢?{�����我怀疑这不是你的观察力, 但这仅仅是问一个戴面具的人的矛盾性质. 请告诉我,你喜欢音乐吗? ��7�我挺好的,你呢���1�我是个程序员O��'�我看不懂.���-�我看得出来.�*�Y�我经常使用 Python, Java 和 C++ .Q��9�我能帮你什么吗?
����歌?����我能问你一个问题吗?]
sqlite> |
���� ? what's this...
But I used Chinese corpus will get this. class ChatbotHandler(RequestHandler):
def get(self, question):
result = '小益费尽了九牛二虎之力未能找到相关内容'
try:
if question:
bot_result = chatbot.get_response(question)
if bot_result:
result = str(bot_result)
except e:
print(e)
self.write(json.dumps({'data': result}, ensure_ascii=False))
self.finish()
def make_app():
return Application([
("/split/(.*)", SplitHandler),
("/chat/(.*)", ChatbotHandler)
], autoreload=True)
def main():
print("listening port 8888...")
app = make_app()
app.listen(8888)
IOLoop.current().start()
if __name__ == "__main__":
main() |
Can you provide an address to download |
here source link http://sqlitebrowser.org/ on ubuntu these commands will work
|
I also get the error unicode. this is my code |
@vkosuri I fixed this bug, change web framework from # coding = utf-8
from chatterbot import ChatBot
from sanic import Sanic
from sanic.response import json
# Initialized API
app = Sanic()
# Initialized chatbot
chatbot = ChatBot(
'SMART-XY',
storage_adapter="chatterbot.storage.SQLStorageAdapter",
database='chatterbot-database',
)
@app.route("/chat", methods=['GET'])
async def chatWithBot(request):
result = str('小益费尽了九牛二虎之力未能找到相关内容')
sentence = str('你说了句啥???')
try:
sentence = str(request.args.get('sentence'))
if sentence:
bot_result = chatbot.get_response(sentence)
if bot_result:
result = str(bot_result)
except e:
print(e)
return json(
{'data': result, 'question': sentence},
ensure_ascii=False
)
def main():
app.run(host="localhost", port=8888)
if __name__ == "__main__":
main() |
This PR will enable sql engine with
convert_unicode=True
More information available here http://docs.sqlalchemy.org/en/latest/core/engines.html#sqlalchemy.create_engine.params.convert_unicodeCloses: #887