Code Monkey home page Code Monkey logo

clause's Introduction

Clause

Chatopera 语义理解服务 / Chatopera Language Understanding Service

Clause 帮助聊天机器人开发商、开发者快速而低成本的获得开源的语义理解系统。

Clause 是 Chatopera 团队自主研发及使用其他商业友好的开源软件的方式实现的,Clause 为实现聊天机器人提供强大的大脑,包括客服、智能问答和自动流程服务。Clause 利用深度学习,自然语言处理和搜索引擎技术,让机器更加理解人。

利用 Clause 可快速实现聊天机器人服务,通过自然语言的人机交互形式完成数据收集和数据处理。

功能

  • 支持多机器人管理,每个机器人可创建多个意图(Intent)

  • 自定义词典(CustomDict),支持词表形式及正则表达式形式

  • 自定义意图(Intent),槽位(Slot)和说法(Utterance)

  • 开箱即用的系统词典(人名、地名、组织机构名和时间等)

  • 支持聊天机器人调试分支和上线分支

  • 支持会话周期管理

  • 服务端为微服务,C++实现;客户端使用 RPC 协议连接进行集成,支持多种语言 SDK

  • 服务端可做集群,支持大规模高并发访问

Clause 的服务端使用 C++编写,并且发布为 Docker 镜像;同时提供的客户端集成接口支持多种语言,包括 Java、Python、Node.js 等,请参考下面的内容进一步了解。

快速开始

使用 Python 快速实现问答机器人(链接)

Docker 安装和部署

下载 Docker 镜像

1/3 购买证书

在 Chatopera 证书商店的产品页面购买证书:

下单地址:https://store.chatopera.com/product/clause001

img

2/3 下载文件

在 Chatopera 证书商店的证书详情页面,得到证书标识。 证书标识是一个字符串,比如:FOO123

文件的下载地址为:

https://store.chatopera.com/dl/`${LICENSE_ID}`.gz

${LICENSE_ID} 替换为您的证书标识。假设上一步得到的证书标识为:FOO123,那么 URL 下载地址就是:

https://store.chatopera.com/dl/FOO123.gz

wget --no-check-certificate https://store.chatopera.com/dl/FOO123.gz -O clause001.tar.gz
tar xzfv clause001.tar.gz        # 进行解压
./activemq.docker.5143.tgz       # 解压得到的文件
./clause.docker.c24ffc1.tgz      # 解压得到的文件
./intent.docker.c24ffc1.tgz      # 解压得到的文件
./mysql.docker.57.tgz            # 解压得到的文件
./README.md                      # 解压得到的文件
./redis.docker.505.tgz           # 解压得到的文件
./sysdicts.docker.c24ffc1.tgz    # 解压得到的文件

下载后的文件是一个压缩包,格式为 tar.gz,该文件使用 7zipWinRAR 等流行的解压工具都可以打开。

除了使用 wget 形式下载,还可以通过浏览器打开 URL 下载。

复制以上脚本,到项目官方地址

3/3 加载镜像

得到上述的各 *.tgz 文件后,在命令行终端执行命令:

docker load < ./activemq.docker.5143.tgz
docker load < ./clause.docker.c24ffc1.tgz
docker load < ./intent.docker.c24ffc1.tgz
docker load < ./mysql.docker.57.tgz
docker load < ./redis.docker.505.tgz
docker load < ./sysdicts.docker.c24ffc1.tgz

执行后,镜像文件就被加载到了 docker images 中。

使用命令验证,执行 docker images,确定出现:

clause/clause:develop
clause/intent:develop
clause/sysdicts:develop
chatopera/activemq:5.14.3
chatopera/mysql:5.7
chatopera/redis:5.0.5

启动服务

使用文档:

欢迎使用

Chatopera 云服务

Clause 同时也是 Chatopera 云服务的一个基础模块。

https://bot.chatopera.com/

Chatopera 云服务是一站式实现聊天机器人的云服务,按接口调用次数计费。Chatopera 云服务是 Chatopera 机器人平台的软件即服务实例。在云计算基础上,Chatopera 云服务属于聊天机器人即服务的云服务。

Chatopera 机器人平台包括知识库、多轮对话、意图识别和语音识别等组件,标准化聊天机器人开发,支持企业 OA 智能问答、HR 智能问答、智能客服和网络营销等场景。企业 IT 部门、业务部门借助 Chatopera 云服务快速让聊天机器人上线!

展开查看 Chatopera 云服务的产品截图

自定义词典

自定义词条

创建意图

添加说法和槽位

训练模型

测试对话

机器人画像

系统集成

聊天历史

立即使用

主题演讲

时间 活动 链接 时长 概述
2019-12-14 Microsoft AI Bootscamp(2019) 回放 40mins 基本使用介绍+支持正则表达式词典
2019-11-03 COSCon '2019 **开源年会 回放PPT【提取码: 25ni】 40mins 基本使用介绍+支持读取文件训练机器人
2019-09-26 CSDN 学院直播:深度学习之智能问答机器人实战 回放 60mins 基本使用介绍

用户交流群

在 Chatopera 客户群中也包括其他用户,请不要发送敏感信息。讨论与 Chatopera 产品和服务相关的事宜

媒体报道

特别鸣谢

  • Lexical Analysis of Chinese: Baidu's open-source lexical analysis tool for Chinese, including word segmentation, part-of-speech tagging & named entity recognition.
  • CRFsuite: a fast implementation of Conditional Random Fields (CRFs)
  • Xapian: an Open Source Search Engine Library

自然语言处理推荐入门&工具书

机器学习 & 自然语言处理入门指南,本书由 Clause 作者参与著作。

快速购书链接

《智能问答与深度学习》 这本书是服务于准备入门机器学习和自然语言处理的学生和软件工程师的,在理论上介绍了很多原理、算法,同时也提供很多示例程序增加实践性,这些程序被汇总到示例程序代码库,这些程序主要是帮助大家理解原理和算法的,欢迎大家下载和执行。代码库的地址是:

https://github.com/l11x0m7/book-of-qna-code

开源许可协议

Copyright (2019-2020) 北京华夏春松科技有限公司

Apache License Version 2.0

chatoper banner

clause's People

Contributors

hailiang-wang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clause's Issues

"Invalid params, customdict obj is required.

postCustomDict result: {"rc":1,"error":"Invalid params, customdict obj is required.","msg":null,"id":null,"chatbotID":null,"customdicts":null,"sysdicts":null,"botsysdicts":null,"dictwords":null,"customdict":null,"sysdict":null,"botsysdict":null,"dictword":null,"intents":null,"slots":null,"utters":null,"intent":null,"slot":null,"utter":null,"devvers":null,"provers":null,"devver":null,"prover":null,"sessions":null,"messages":null,"session":null,"message":null,"currpage":null,"totalpage":null,"totalrows":null,"pagesize":null,"page":null,"query":null} +0ms
在node.js使用中 报错 使用官方的测试成功

pip install clause 报错;错误信息如下

Collecting clause
Using cached https://files.pythonhosted.org/packages/15/01/603f7a3d8711c514c4fc6e150b282fc94d4791e76c84b6048dd2e5940bb1/clause-1.1.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-t3euV0/clause/setup.py", line 3, in
from clause import version
File "clause/init.py", line 19, in
from .gen.clause import ttypes, constants, Serving
File "clause/gen/clause/ttypes.py", line 21
SyntaxError: Non-ASCII character '\xe5' in file clause/gen/clause/ttypes.py on line 22, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-t3euV0/clause/

clause centos部署出行问题

部署clause服务时
Digest: sha256:b15cf21b66c6a4e98e78aa458fa56caf43b5338b3d5710326c2666ee265a83c6
Status: Downloaded newer image for chatopera/activemq:5.14.3
Pulling intent (chatopera/intent:develop)...
到这里又不动了,是不是没有放出来,或者咱们的访问有限制?

提供不同语言的客户端代码

命令:

~/git/clause/bin/thrift --gen php -o . ../thrift/server.dsl
~/git/clause/bin/thrift --gen js:node -o . ../thrift/server.dsl
~/git/clause/bin/thrift --gen cpp -o . ../thrift/server.dsl
~/git/clause/bin/thrift --gen csharp -o . ../thrift/server.dsl
~/git/clause/bin/thrift --gen py -o . ../thrift/server.dsl
~/git/clause/bin/thrift --gen java -o . ../thrift/server.dsl

知识库

概述

理想解决方案

代码版本

来自

  • 行业:
  • 公司/团队 官网:

Open Source for the World by Chatopera

chatoper banner

如果想训练知识库,应该如何配置,是在profile.json里配置吗,谢谢

支持正则表达式词典

Description

当前1.1.0版本支持正则表达式词典。

拉取最新镜像。

docker-compose pull

全新安装

拉取最新的docker镜像,启动服务。
参考部署文档

升级

拉取最新的镜像,然后在数据库内执行升级脚本

使用说明

参考示例程序

Solution

服务正常启动,但运行py-demo报错

服务端是linux,使用docker部署了clause,启动显示正常。
在windows上,使用vscode运行 clause-py-demo 工程,报错如下:
“UnicodeDecodeError: 'gbk' codec can't decode byte 0x85 in position 190: illegal multibyte sequence”
把with open(os.path.join(curdir, "profile.json"), 'r') as f: 中的'r'改成‘rb’后编码的问题解决,又报以下问题:
[connect] clause host 172.16.1.103, port 8056
[clean_up_bot] remove intent take_out
[create] dict name food
[create] dict name phoneNumber
[create] intent name take_out
[create] intent slot time
[create] intent slot loc
[create] intent slot food
[create] intent slot phone
[create] intent utter 我想订一份{food}
[create] intent utter 我想点外卖
[create] intent utter 我想点一份外卖,{time}用餐
[create] intent utter 我想点一份{food},送到{loc}
[train] start to train bot ...
[train] error Data(rc=None, error=None, msg=None, id=None, chatbotID=None, customdicts=None, sysdicts=None, botsysdicts=None, dictwords=None, customdict=None, sysdict=None, botsysdict=None, dictword=None, dictpattern=None, patterncheck=None, patternchecks=None, intents=None, slots=None, utters=None, intent=None, slot=None, utter=None, devvers=None, provers=None, devver=None, prover=None, sessions=None, messages=None, session=None, message=None, currpage=None, totalpage=None, totalrows=None, pagesize=None, page=None, query=None)
Traceback (most recent call last):
File "f:/study/clause-py-demo/bot.py", line 169, in
raise Exception("Unexpected response with training bot request.")
Exception: Unexpected response with training bot request.

在 clause server服务内运行 docker-compose logs -f 查看日志,发现以下内容:
clause_1 | SELECT id, description, createdate, updatedate from cl_intents WHERE chatbotID ='bot007' and name = 'take_out'
clause_1 | ---
clause_1 | I0927 10:15:54.910068 36 maf.hpp:137] getDictDetailByChatbotIDAndName name: @time, chatbotID: @Builtin, isBuiltin: 1
clause_1 | I0927 10:15:54.910094 36 maf.hpp:151] getDictDetailByChatbotIDAndName execute SQL:
clause_1 | ---
clause_1 | SELECT id, name, chatbotID, description, createdate, updatedate, samples, type, vendor, builtin, active from cl_dicts WHERE name ='@time' and chatbotID = '@Builtin'
clause_1 | ---
clause_1 | I0927 10:15:54.910348 36 handler.cpp:3259] # ERR: SQLException in /home/hain/git/clause/src/clause/src/handler.cpp
clause_1 | I0927 10:15:54.910369 36 handler.cpp:3261] # ERR: Unknown column 'type' in 'field list'

如何注册zookeeper

您好,在部署过程中遇到了部署均衡的问题,请问如何配置clause的注册中心信息?谢谢!

sysdicts没有启动成功问题

下载 clause-osc之后 进入admin/docker 执行 ./start.sh
报错:clauseosc_sysdicts_1 exited with code 132
单独启动显示
root@075cd2541a79:/app# ./sysdicts_server "--flagfile=/config/cmd.flags"
Illegal instruction (core dumped)

导致:
clause_1 | Thrift: Mon May 11 14:37:27 2020 TSocket::open() getaddrinfo() <Host: sysdicts Port: 8066>Name or service not known
clause_1 | I0511 14:37:27.393725 1 client.cpp:47] sysdicts init exception: Could not resolve host for client socket.
clause_1 | I0511 14:37:27.393741 1 handler.cpp:120] Init fails, exception in Sysdicts.
clause_1 | F0511 14:37:27.393748 1 main.cpp:67] Check failed: handler->init() [Fatal Error] Serving Handler fails to init.
报错

通过 docker-compose ps 查看
chatopera/sysdicts:develop "/app/sysdicts_ser..." About a minute ago Restarting (132) 32 seconds ago

redis,mq,mysql,intend 服务启动正常

Docker version 17.06.2-ce, build cec0b72

docker-compose version 1.15.0, build e12f3b9

操作系统信息:
Linux version 3.10.0-693.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Tue Aug 22 21:09:27 UTC 2017

CentOS Linux release 7.4.1708 (Core)

gcc 信息:
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

服务管理脚本

发布版本,打包。
增加服务启动,清数据,服务停止等脚本。

python 多线程同时访问, AttributeError: 'NoneType' object has no attribute 'id'

使用python多进程调用服务器上启动的服务,session = bot.putSession,报AttributeError: 'NoneType' object has no attribute 'id',thrift.transport.TTransport.TTransportException: TSocket read 0 bytes的错误,代码如下:
def print_time(j):
bot = Client("xxx.xx.xxx.xxx", "xxxx")
chatbotID = "123"
text = "今天天气"
print("[chat] human: %s" % text)
session = bot.putSession(Data(session=ChatSession(chatbotID=chatbotID,
uid=f"py{j}",
channel="testclient",
branch="dev"
))).session
resp = bot.chat(Data(session=ChatSession(id=session.id), message=ChatMessage(textMessage=text)))
if resp.session.resolved:
intent_name = resp.session.intent_name
print("意图的名字是:", intent_name)
for i in resp.session.entities:
print("词槽的名称是:", i)
else:
print("[错误] 返回不符合逻辑")
bot.destroy()

for j in range(5):
t = threading.Thread(target=print_time, args=(j,))
t.start()

ubuntu 16.04 make 编译错误,详细内容

root@jydatatop-virtual-machine:/soft/clause# cmake ../..
CMake Error: The source directory "/" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
root@jydatatop-virtual-machine:/soft/clause# make
make: *** 没有指明目标并且找不到 makefile。 停止。
root@jydatatop-virtual-machine:/soft/clause#

开源语义理解引擎有相关api文档吗!?

您好?

开源语义理解引擎有相关api文档吗!?
比如,语义理解有哪些接口或方法?
返回的正确 /错误代码有哪些?如rc:0, msg:train job is dispatched.
系统词典,有哪些等等?

知识库

如果想训练知识库,应该如何配置,是在profile.json里配置吗,谢谢

No rule to make target '../../lib/libthriftnb.so', needed by 'src/clause/clause_server'

ubuntu:~/clause/build/debug$ make

[ 32%] Building CXX object src/clause/CMakeFiles/clause_server.dir/serving/server_constants.cpp.o
[ 33%] Building CXX object src/clause/CMakeFiles/clause_server.dir/serving/server_types.cpp.o
make[2]: *** No rule to make target '../../lib/libthriftnb.so', needed by 'src/clause/clause_server'. Stop.
CMakeFiles/Makefile2:347: recipe for target 'src/clause/CMakeFiles/clause_server.dir/all' failed
make[1]: *** [src/clause/CMakeFiles/clause_server.dir/all] Error 2
Makefile:90: recipe for target 'all' failed

环境:ubuntu 18.04,使用官方脚本并执行sudo apt-get install libevent-dev

It takes very long time on training and no results

描述

提交公司信息说明后优先处理解决!

现在行为

root@128bb1f63e75:/data# ls
LICENSE README.md assets bot.py docker-compose.yml profile.json requirements.txt sample.env scripts var
root@128bb1f63e75:/data# python bot.py
[connect] clause host clause, port 8056
[create] dict name food
[create] dict name phoneNumber
[create] intent name take_out
[create] intent slot time
[create] intent slot loc
[create] intent slot food
[create] intent slot phone
[create] intent utter 我想订一份{food}
[create] intent utter 我想点外卖
[create] intent utter 我想点一份外卖,{time}用餐
[create] intent utter 我想点一份{food},送到{loc}
[train] start to train bot ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
[train] in progress ...
......

预期行为

如示例截屏所示,模型应该能很快训练完成

解决方案

No

环境

  • 代码版本:
    Git commit hash (git rev-parse HEAD)
    aed7470

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.