Home
Softono
c

chatopera

Professional software vendor delivering innovative solutions on the Softono platform. Specialized in both open-source and proprietary software development.

Total Products
3

Software by chatopera

Synonyms
Open Source

Synonyms

[![PyPI](https://img.shields.io/pypi/v/synonyms.svg)](https://pypi.python.org/pypi/synonyms) [![PyPI download month](https://img.shields.io/pypi/dm/synonyms.svg)](https://pypi.python.org/pypi/synonyms/) [![](https://img.shields.io/pypi/pyversions/synonyms.svg)](https://pypi.org/pypi/synonyms/) [![License](https://cdndownload2.chatopera.com/cskefu/licenses/chunsong1.0.svg)](https://www.cskefu.com/licenses/v1.html "开源许可协议") [![](https://img.shields.io/pypi/format/synonyms.svg)](https://pypi.org/pypi/synonyms/) # Synonyms Chinese Synonyms for Natural Language Processing and Understanding. 更好的中文近义词:聊天机器人、智能问答工具包。 `synonyms`可以用于自然语言理解的很多任务:[RAG (Retrieval-Augmented Generation)](https://gitee.com/chatopera/embeddings-zh),推荐算法,相似度计算,语义偏移,关键字提取,智能问答,自动摘要,搜索引擎等。 为提供稳定、可靠、长期优化的服务,Synonyms 改为使用 [春松许可证, v1.0](https://www.cskefu.com/licenses/v1.html) 并针对机器学习模型的下载进行收费,详见[证书商店](https://store.chatopera.com/product/syns001)。之前的贡献者(突出贡献的代码贡献者),可与我们联系,讨论收费问题。-- [Chatopera Inc.](https://www.chatopera.com) @ Oct. 2023 # Table of Content: - [Install](https://github.com/chatopera/Synonyms#welcome) - [Usage](https://github.com/chatopera/Synonyms#usage) - [Quick Get Start](https://github.com/chatopera/Synonyms#quick-get-start) - [Valuation](https://github.com/chatopera/Synonyms#valuation) - [Benchmark](https://github.com/chatopera/Synonyms#benchmark) - [Statement](https://github.com/chatopera/Synonyms#statement) - [References](https://github.com/chatopera/Synonyms#references) - [Frequently Asked Questions](https://github.com/chatopera/Synonyms#frequently-asked-questions-faq) - [License](https://github.com/chatopera/Synonyms#license) # Welcome Follow steps below to install and activate packages. ## 1/3 Install Sourcecodes Package ```bash pip install -U synonyms ``` 当前稳定版本 v3.x。 ## 2/3 Config license id Synonyms's machine learning model package(s) requires a License from [Chatopera License Store](https://store.chatopera.com/product/syns001), first purchase a License and get the `license id` from **Licenses** page on Chatopera License Store(`license id`:在证书商店,证书详情页,点击【复制证书标识】). ![image](./assets/syn_order_post.jpg) Secondly, set environment variable in your terminal or shell scripts as below. * For Shell Users e.g. Shell, CMD Scripts on Linux, Windows, macOS. ```bash # Linux / macOS export SYNONYMS_DL_LICENSE=YOUR_LICENSE ## e.g. if your license id is `FOOBAR`, run `export SYNONYMS_DL_LICENSE=FOOBAR` # Windows ## 1/2 Command Prompt set SYNONYMS_DL_LICENSE=YOUR_LICENSE ## 2/2 PowerShell $env:SYNONYMS_DL_LICENSE='YOUR_LICENSE' ``` * For Python Code Users Jupyter Notebook, etc. ```python import os os.environ["SYNONYMS_DL_LICENSE"] = "YOUR_LICENSE" _licenseid = os.environ.get("SYNONYMS_DL_LICENSE", None) print("SYNONYMS_DL_LICENSE=", _licenseid) ``` ![](./assets/screenshot_20231124180125.png) **提示:安装后初次使用会下载词向量文件,下载速度取决于网络情况。** ## 3/3 Download Model Package Last, download the model package by command or script - ```bash python -c "import synonyms; synonyms.display('能量')" # download word vectors file ``` ![](./assets/3.gif) ## Usage 支持使用环境变量配置分词词表和 word2vec 词向量文件。 | 环境变量 | 描述 | | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | _SYNONYMS_WORD2VEC_BIN_MODEL_ZH_CN_ | 使用 word2vec 训练的词向量文件,二进制格式。 | | _SYNONYMS_WORDSEG_DICT_ | 中文分词[**主字典**](https://github.com/fxsjy/jieba#%E5%BB%B6%E8%BF%9F%E5%8A%A0%E8%BD%BD%E6%9C%BA%E5%88%B6),格式和使用[参考](https://github.com/fxsjy/jieba#%E8%BD%BD%E5%85%A5%E8%AF%8D%E5%85%B8) | | _SYNONYMS_DEBUG_ | ["TRUE"\|"FALSE"], 是否输出调试日志,设置为 “TRUE” 输出,默认为 “FALSE” | ### 熟悉接口 ```bash $ pip install -r Requirements.txt $ python demo.py ``` ### 实现 RAG (Retrieval-Augmented Generation)服务 查看示例程序, [hailiang-wang/llm-get-started](https://github.com/hailiang-wang/llm-get-started/tree/master/003_rag_langchain) ## APIs ### synonyms.nearby(word [, size = 10]) ```python import synonyms print("人脸: ", synonyms.nearby("人脸")) print("识别: ", synonyms.nearby("识别")) print("NOT_EXIST: ", synonyms.nearby("NOT_EXIST")) ``` `synonyms.nearby(WORD [,SIZE])`返回一个元组,元组中包含两项:`([nearby_words], [nearby_words_score])`,`nearby_words`是 WORD 的近义词们,也以 list 的方式存储,并且按照距离的长度由近及远排列,`nearby_words_score`是`nearby_words`中**对应位置**的词的距离的分数,分数在(0-1)区间内,越接近于 1,代表越相近;`SIZE` 是返回词汇数量,默认 10。比如: ```python synonyms.nearby(人脸, 10) = ( ["图片", "图像", "通过观察", "数字图像", "几何图形", "脸部", "图象", "放大镜", "面孔", "Mii"], [0.597284, 0.580373, 0.568486, 0.535674, 0.531835, 0.530 095, 0.525344, 0.524009, 0.523101, 0.516046]) ``` 在 OOV 的情况下,返回 `([], [])`,目前的字典大小: 435,729。 ### synonyms.compare(sen1, sen2 [, seg=True]) 两个句子的相似度比较 ```python sen1 = "发生历史性变革" sen2 = "发生历史性变革" r = synonyms.compare(sen1, sen2, seg=True) ``` 其中,参数 seg 表示 synonyms.compare 是否对 sen1 和 sen2 进行分词,默认为 True。返回值:[0-1],并且越接近于 1 代表两个句子越相似。 ```python 旗帜引领方向 vs 道路决定命运: 0.429 旗帜引领方向 vs 旗帜指引道路: 0.93 发生历史性变革 vs 发生历史性变革: 1.0 ``` ### synonyms.display(word [, size = 10]) 以友好的方式打印近义词,方便调试,`display(WORD [, SIZE])`调用了 `synonyms#nearby` 方法。 ```python >>> synonyms.display("飞机") '飞机'近义词: 1. 飞机:1.0 2. 直升机:0.8423391 3. 客机:0.8393003 4. 滑翔机:0.7872388 5. 军用飞机:0.7832081 6. 水上飞机:0.77857226 7. 运输机:0.7724742 8. 航机:0.7664748 9. 航空器:0.76592904 10. 民航机:0.74209654 ``` `SIZE` 是打印词汇表的数量,默认 10。 ### synonyms.describe() 打印当前包的描述信息: ``` >>> synonyms.describe() Vocab size in vector model: 435729 model_path: /Users/hain/chatopera/Synonyms/synonyms/data/words.vector.gz version: 3.18.0 {'vocab_size': 435729, 'version': '3.18.0', 'model_path': '/chatopera/Synonyms/synonyms/data/words.vector.gz'} ``` ### synonyms.v(word) 获得一个词语的向量,该向量为 numpy 的 array,当该词语是未登录词时,抛出 KeyError 异常。 ```python >>> synonyms.v("飞机") array([-2.412167 , 2.2628384 , -7.0214124 , 3.9381874 , 0.8219283 , -3.2809453 , 3.8747153 , -5.217062 , -2.2786229 , -1.2572327 ], dtype=float32) ``` ### synonyms.sv(sentence, ignore=False) 获得一个分词后句子的向量,向量以 array[array[]] 方式组成,即获取 sentence 中每个词的向量 array[] 放在一个 array 中 ```python sentence: 句子是分词后通过空格联合起来 ignore: 是否忽略OOV,False时,随机生成一个向量 ``` ### synonyms.bow(sentence, ignore=False) 获得一个分词后句子的向量,向量以 BoW 方式组成 ```python sentence: 句子是分词后通过空格联合起来 ignore: 是否忽略OOV,False时,随机生成一个向量 ``` ### synonyms.seg(sentence) 中文分词 ```python synonyms.seg("中文近义词工具包") ``` 分词结果,由两个 list 组成的元组,分别是单词和对应的词性。 ```python (['中文', '近义词', '工具包'], ['nz', 'n', 'n']) ``` **该分词不去停用词和标点。** ### synonyms.keywords(sentence [, topK=5, withWeight=False]) 提取关键词,默认按照重要程度提取关键词。 ``` keywords = synonyms.keywords("9月15日以来,台积电、高通、三星等华为的重要合作伙伴,只要没有美国的相关许可证,都无法供应芯片给华为,而中芯国际等国产芯片企业,也因采用美国技术,而无法供货给华为。目前华为部分型号的手机产品出现货少的现象,若该形势持续下去,华为手机业务将遭受重创。") ``` ## Contribution Get more logs for debugging, set environment variable. ``` SYNONYMS_DEBUG=TRUE ``` ## PCA 以“人脸”为例主要成分分析: ![](assets/1.png) ## Change logs 更新情况[说明](./CHANGELOG.md)。 ## Voice of Users 用户怎么说: <img src="https://github.com/chatopera/Synonyms/raw/master/assets/4.png" width="600"> ## Data data is built based on [wikidata-corpus](https://github.com/Samurais/wikidata-corpus). ## Valuation ### 同义词词林 《同义词词林》是梅家驹等人于 1983 年编纂而成,现在使用广泛的是哈工大社会计算与信息检索研究中心维护的《同义词词林扩展版》,它精细的将中文词汇划分成大类和小类,梳理了词汇间的关系,同义词词林扩展版包含词语 7 万余条,其中 3 万余条被以开放数据形式共享。 ### 知网, HowNet HowNet,也被称为知网,它并不只是一个语义字典,而是一个知识系统,词汇之间的关系是其一个基本使用场景。知网包含词语 8 余条。 国际上对词语相似度算法的评价标准普遍采用 Miller&Charles 发布的英语词对集的人工判定值。该词对集由十对高度相关、十对中度相关、十对低度相关共 30 个英语词对组成,然后让 38 个受试者对这 30 对进行语义相关度判断,最后取他们的平均值作为人工判定标准。然后不同近义词工具也对这些词汇进行相似度评分,与人工判定标准做比较,比如使用皮尔森相关系数。在中文领域,使用这个词表的翻译版进行中文近义词比较也是常用的办法。 ### 对比 Synonyms 的词表容量是 435,729,下面选择一些在同义词词林、知网和 Synonyms 都存在的几个词,给出其近似度的对比: ![](./assets/5.png) 注:同义词林及知网数据、分数[来源](https://github.com/yaleimeng/Final_word_Similarity)。Synonyms 也在不断优化中,新的分数可能和上图不一致。 更多[比对结果](./VALUATION.md)。 ## Used by [Github 关联用户列表](https://github.com/chatopera/Synonyms/network/dependents?package_id=UGFja2FnZS01MjY2NDc1Nw%3D%3D) ![](./assets/6.png) ## Benchmark Test with py3, MacBook Pro. ``` python benchmark.py ``` ++++++++++ OS Name and version ++++++++++ Platform: Darwin Kernel: 16.7.0 Architecture: ('64bit', '') ++++++++++ CPU Cores ++++++++++ Cores: 4 CPU Load: 60 ++++++++++ System Memory ++++++++++ meminfo 8GB `synonyms#nearby: 100000 loops, best of 3 epochs: 0.209 usec per loop` ## Live Sharing [52nlp.cn](http://www.52nlp.cn/synonyms-%E4%B8%AD%E6%96%87%E8%BF%91%E4%B9%89%E8%AF%8D%E5%B7%A5%E5%85%B7%E5%8C%85) [机器之心](https://www.jiqizhixin.com/articles/2018-01-14-3) [线上分享实录: Synonyms 中文近义词工具包 @ 2018-02-07](http://gitbook.cn/gitchat/activity/5a563545a8b23d387720ccd5) ## Statement [Synonyms](https://github.com/chatopera/Synonyms)发布证书 MIT。数据和程序可用于研究和商业产品,必须注明引用和地址,比如发布的任何媒体、期刊、杂志或博客等内容。 ``` @online{Synonyms:hain2017, author = {Hai Liang Wang, Hu Ying Xi}, title = {中文近义词工具包Synonyms}, year = 2017, url = {https://github.com/chatopera/Synonyms}, urldate = {2017-09-27} } ``` # References [wikidata-corpus](https://github.com/Samurais/wikidata-corpus) [word2vec 原理推导与代码分析](http://www.hankcs.com/nlp/word2vec.html) # Frequently Asked Questions (FAQ) 1. 是否支持添加单词到词表中? 不支持,欲了解更多请看 [#5](https://github.com/chatopera/Synonyms/issues/5) 2. 词向量的训练是用哪个工具? Google 发布的[word2vec](https://code.google.com/archive/p/word2vec/),该库由 C 语言编写,内存使用效率高,训练速度快。gensim 可以加载 word2vec 输出的模型文件。 3. 相似度计算的方法是什么? [详见 #64](https://github.com/chatopera/Synonyms/issues/64) 4. [#118 词向量文件一直下载不下来?](https://github.com/chatopera/Synonyms/issues/118) 5. [#146 Synonyms 和 Langchain 实现 RAG 检索服务](https://github.com/chatopera/Synonyms/issues/146) # Authors [Hai Liang Wang](https://pre-angel.com/peoples/hailiang-wang/) [Hu Ying Xi](https://github.com/huyingxi) # 自然语言处理推荐入门&工具书 本书由 [Synonyms](https://github.com/chatopera/Synonyms) 作者参与著作。 <p align="center"> <b>快速购书<a href="https://item.jd.com/12479014.html" target="_blank">链接</a></b><br> <a href="https://item.jd.com/12479014.html" target="_blank"> <img src="https://user-images.githubusercontent.com/3538629/48657619-bcd24880-ea6e-11e8-8c4e-8bcb00761942.png" width="400"> </a> </p> [《智能问答与深度学习》](https://item.jd.com/12479014.html) 这本书是服务于准备入门机器学习和自然语言处理的学生和软件工程师的,在理论上介绍了很多原理、算法,同时也提供很多示例程序增加实践性,这些程序被汇总到示例程序代码库,这些程序主要是帮助大家理解原理和算法的,欢迎大家下载和执行。代码库的地址是: [https://github.com/l11x0m7/book-of-qna-code](https://github.com/l11x0m7/book-of-qna-code) # Give credits to [Word2vec by Google](https://code.google.com/archive/p/word2vec/) [Wikimedia: 训练语料来源](https://dumps.wikimedia.org/) [gensim: word2vec.py](https://github.com/RaRe-Technologies/gensim) [SentenceSim: 相似度评测语料](https://github.com/fssqawj/SentenceSim/) [jieba: 中文分词](https://github.com/fxsjy/jieba) # License [Chunsong Public License, version 1.0](./LICENSE) # Project Sponsor ## Chatopera 云服务 [https://bot.chatopera.com/](https://bot.chatopera.com/) [Chatopera 云服务](https://bot.chatopera.com)是一站式实现聊天机器人的云服务,按接口调用次数计费。Chatopera 云服务是 [Chatopera 机器人平台](https://docs.chatopera.com/products/chatbot-platform/index.html)的软件即服务实例。在云计算基础上,Chatopera 云服务属于**聊天机器人即服务**的云服务。 Chatopera 机器人平台包括知识库、多轮对话、意图识别和语音识别等组件,标准化聊天机器人开发,支持企业 OA 智能问答、HR 智能问答、智能客服和网络营销等场景。企业 IT 部门、业务部门借助 Chatopera 云服务快速让聊天机器人上线!

ML Frameworks CRM
5.1K Github Stars
insuranceqa-corpus-zh
Open Source

insuranceqa-corpus-zh

[![PyPI](https://img.shields.io/pypi/v/insuranceqa_data.svg)](https://pypi.python.org/pypi/insuranceqa_data) [![PyPI download month](https://img.shields.io/pypi/dm/insuranceqa_data.svg)](https://pypi.python.org/pypi/insuranceqa_data/) [![](https://img.shields.io/pypi/pyversions/insuranceqa_data.svg)](https://pypi.org/pypi/insuranceqa_data/) [![PyPI version shields.io](https://img.shields.io/pypi/v/insuranceqa_data.svg)](https://pypi.python.org/pypi/insuranceqa_data/) [![License](https://cdndownload2.chatopera.com/cskefu/licenses/chunsong1.0.svg)](https://www.cskefu.com/licenses/v1.html "开源许可协议") [![](https://img.shields.io/pypi/format/insuranceqa_data.svg)](https://pypi.org/pypi/insuranceqa_data/) # 保险行业语料库 该语料库包含从网站[Insurance Library](http://www.insurancelibrary.com/) 收集的问题和答案。 据我们所知,本数据集发布之时,2017 年,这是保险领域首个开放的QA语料库: * 该语料库的内容由现实世界的用户提出,高质量的答案由具有深度领域知识的专业人士提供。 所以这是一个具有真正价值的语料,而不是玩具。 * 在上述论文中,语料库用于答复选择任务。 另一方面,这种语料库的其他用法也是可能的。 例如,通过阅读理解答案,观察学习等自主学习,使系统能够最终拿出自己的看不见的问题的答案。 * 数据集分为两个部分“问答语料”和“问答对语料”。问答语料是从原始英文数据翻译过来,未经其他处理的。问答对语料是基于问答语料,又做了分词和去标去停,添加label。所以,"问答对语料"可以直接对接机器学习任务。如果对于数据格式不满意或者对分词效果不满意,可以直接对"问答语料"使用其他方法进行处理,获得可以用于训练模型的数据。 ## 安装使用 ### 1/3 依赖 * Python: 2.x, 3.x * Pip ### 2/3 安装脚本包 ``` pip install -U insuranceqa_data ``` ### 3/3 安装语料包 进入[证书商店](https://store.chatopera.com/product/insqa001),购买证书,购买后进入【证书-详情】,点击【复制证书标识】。 ![](https://cdndownload2.chatopera.com/store/imgs/insqa001-ordering-img.jpg) 然后,通过以下两种形式完成下载。 * 方式1:Python 源代码 ```python import os # 设置证书标识,购买自 https://store.chatopera.com/product/insqa001 os.environ["INSQA_DL_LICENSE"] = "YOUR_LICENSE" # _licenseid = os.environ.get("INSQA_DL_LICENSE", None) print("INSQA_DL_LICENSE=%s" % _licenseid) # 初次下载数据 import insuranceqa_data insuranceqa_data.download_corpus() ``` 将上面 `YOUR_LICENSE` 修改为您的 证书标识!!!然后执行这段 Python 脚本,比如将上述脚本保存为 `download.py`,然后执行: ```bash python download.py ``` * 方式2:设置环境变量 设置环境变量 `INSQA_DL_LICENSE`,比如使用命令行终端: ```bash # Linux / macOS export INSQA_DL_LICENSE=YOUR_LICENSE ## e.g. if your license id is `FOOBAR`, run `export INSQA_DL_LICENSE=FOOBAR` # Windows ## 1/2 Command Prompt set INSQA_DL_LICENSE=YOUR_LICENSE ## 2/2 PowerShell $env:INSQA_DL_LICENSE='YOUR_LICENSE' ``` 最后,执行以下命令,完成数据的下载。 ```bash python -c "import insuranceqa_data; insuranceqa_data.download_corpus()" ``` ## 数据格式说明 ```python # 读取数据测试 train_data = insuranceqa_data.load_pool_train() # 训练集 test_data = insuranceqa_data.load_pool_test() # 测试集 valid_data = insuranceqa_data.load_pool_valid() # 验证集 answers_data = insuranceqa_data.load_pool_answers() # 打印 训练集 数据;测试集和验证集与 训练集 数据结构一致 for x in train_data: # 打印数据 print('\n\nIndex %s \n question: %s' % \ (x, train_data[x]['zh'])) print(" answer: ") idx = 0 for y in train_data[x]['answers']: idx += 1 print(" %d. %s" % (idx, answers_data[y]["zh"])) ``` ![alt text](assets/media/1748242469631.png) 数据格式的详细介绍见下。 #### 数据设计 | - | 问题 | 答案 | 词汇(英语) | | ------------- |-------------| ----- | ----- | | 训练 | 12,889 | 21,325 | 107,889 | | 验证 | 2,000 | 3354 | 16,931 | | 测试 | 2,000 | 3308 | 16,815 | 每条数据包括问题的中文,英文,答案的正例,答案的负例。案的正例至少1项,基本上在*1-5*条,都是正确答案。答案的负例有*200*条,负例根据问题使用检索的方式建立,所以和问题是相关的,但却不是正确答案。 ``` { "INDEX": { "zh": "中文", "en": "英文", "domain": "保险种类", "answers": [""] # 答案正例列表 "negatives": [""] # 答案负例列表 }, more ... } ``` * 训练:```corpus/pool/train.json.gz``` * 验证:```corpus/pool/valid.json.gz``` * 测试:```corpus/pool/test.json.gz``` * 答案:```corpus/pool/answers.json``` 一共有 27,413 个回答,数据格式为 ```json```: ``` { "INDEX": { "zh": "中文", "en": "英文" }, more ... } ``` ## 机器学习项目 可将本语料库和以下开源码配合使用 [deep-qa-1](https://github.com/chatopera/insuranceqa-corpus-zh/tree/release/deep_qa_1): Baseline model [InsuranceQA TensorFlow](https://github.com/l11x0m7/InsuranceQA_zh): CNN with TensorFlow [n-grams-get-started](https://github.com/Samurais/n-grams-get-started): N元模型 [word2vec-get-started](https://github.com/Samurais/word2vec-get-started): 词向量模型 ## 声明 声明1 : [insuranceqa-corpus-zh](https://github.com/chatopera/insuranceqa-corpus-zh) 本数据集使用翻译 [insuranceQA](https://github.com/shuzi/insuranceQA)而生成,代码发布证书[Chunsong Public License, version 1.0](https://www.cskefu.com/licenses/v1.html)。数据仅限于研究用途,如果在发布的任何媒体、期刊、杂志或博客等内容时,必须注明引用和地址。 ``` InsuranceQA Corpus, Chatopera Inc., https://github.com/chatopera/insuranceqa-corpus-zh, 07 27, 2017 ``` 任何基于[insuranceqa-corpus](https://github.com/chatopera/insuranceqa-corpus-zh)衍生的数据也需要开放并需要声明和“声明1”和“声明2”一致的内容。 声明2 : [insuranceQA](https://github.com/shuzi/insuranceQA) 此数据集仅作为研究目的提供。如果您使用这些数据发表任何内容,请引用我们的论文:[Applying Deep Learning to Answer Selection: A Study and An Open Task](https://arxiv.org/abs/1508.01585)。Minwei Feng, Bing Xiang, Michael R. Glass, Lidan Wang, Bowen Zhou @ 2015

AI & Machine Learning Data Labeling
1.1K Github Stars
clause
Open Source

clause

<div align=right> [主页](https://github.com/chatopera/clause) | [Chatopera 云服务](https://docs.chatopera.com/) | [开发者文档](https://github.com/chatopera/clause/wiki) | [博客专栏](https://chatopera.blog.csdn.net/) </div> # Clause Chatopera 语义理解服务 / Chatopera Language Understanding Service <p align="center"> <a href="https://github.com/chatopera/clause" target="_blank"> <img src="https://static-public.chatopera.com/assets/images/64316956-e4d46d80-cfe8-11e9-8342-ec8a250074bf.png" width="800"> </a> </p> Clause 帮助聊天机器人开发商、开发者快速而低成本的获得开源的语义理解系统。 Clause 是 Chatopera 团队自主研发及使用其他商业友好的开源软件的方式实现的,Clause 为实现聊天机器人提供强大的大脑,包括客服、智能问答和自动流程服务。Clause 利用深度学习,自然语言处理和搜索引擎技术,让机器更加理解人。 利用 Clause 可快速实现聊天机器人服务,通过自然语言的人机交互形式完成数据收集和数据处理。 ## 功能 - 支持多机器人管理,每个机器人可创建多个意图(Intent) - 自定义词典(CustomDict),支持词表形式及正则表达式形式 - 自定义意图(Intent),槽位(Slot)和说法(Utterance) - 开箱即用的系统词典(人名、地名、组织机构名和时间等) - 支持聊天机器人调试分支和上线分支 - 支持会话周期管理 - 服务端为微服务,C++实现;客户端使用 RPC 协议连接进行集成,支持多种语言 SDK - 服务端可做集群,支持大规模高并发访问 **Clause 的服务端使用 C++编写,并且发布为 Docker 镜像;同时提供的客户端集成接口支持多种语言,包括 Java、Python、Node.js 等,请参考下面的内容进一步了解。** ## 快速开始 <p align="center"> <b>使用 Python 快速实现问答机器人</b><a href="https://github.com/chatopera/clause-py-demo">(链接)</a><br> <img src="https://static-public.chatopera.com/assets/images/65892122-54ffc480-e3d8-11e9-8f64-c82f25694df5.gif" width="800"> </p> ## Docker 安装和部署 ### 下载 Docker 镜像 #### 1/3 购买证书 在 Chatopera 证书商店的产品页面购买证书: 下单地址:[https://store.chatopera.com/product/clause001](https://store.chatopera.com/product/clause001) ![img](https://cdndownload2.chatopera.com/store/imgs/clause_purc_20231122114514.png) #### 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`,该文件使用 `7zip` 或 `WinRAR` 等流行的解压工具都可以打开。 除了使用 `wget` 形式下载,还可以通过浏览器打开 URL 下载。 复制以上脚本,到[项目官方地址](https://github.com/chatopera/clause)。 #### 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 ``` ### 启动服务 使用文档: * [GitHub Wiki](https://github.com/chatopera/clause/wiki/%E6%9C%8D%E5%8A%A1%E9%83%A8%E7%BD%B2) * [(备份地址) Gitee Wiki](https://gitee.com/chatopera/clause/wikis/%E6%9C%8D%E5%8A%A1%E9%83%A8%E7%BD%B2) ## 欢迎使用 - [概述](https://github.com/chatopera/clause/wiki/%E6%A6%82%E8%BF%B0) - [系统设计与实现](https://github.com/chatopera/clause/wiki/%E7%B3%BB%E7%BB%9F%E8%AE%BE%E8%AE%A1%E4%B8%8E%E5%AE%9E%E7%8E%B0) - [示例程序](https://github.com/chatopera/clause/wiki/%E7%A4%BA%E4%BE%8B%E7%A8%8B%E5%BA%8F) - [开发环境搭建](https://github.com/chatopera/clause/wiki/%E5%BC%80%E5%8F%91%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA) - [系统集成](https://github.com/chatopera/clause/wiki/%E7%B3%BB%E7%BB%9F%E9%9B%86%E6%88%90) - [API 文档](https://github.com/chatopera/clause/wiki/API%E6%96%87%E6%A1%A3) - [FAQ](https://github.com/chatopera/clause/wiki/FAQ) ## Chatopera 云服务 Clause 同时也是 [Chatopera 云服务](https://bot.chatopera.com/)的一个基础模块。 [https://bot.chatopera.com/](https://bot.chatopera.com/) [Chatopera 云服务](https://bot.chatopera.com)是一站式实现聊天机器人的云服务,按接口调用次数计费。Chatopera 云服务是 [Chatopera 机器人平台](https://docs.chatopera.com/products/chatbot-platform/index.html)的软件即服务实例。在云计算基础上,Chatopera 云服务属于**聊天机器人即服务**的云服务。 Chatopera 机器人平台包括知识库、多轮对话、意图识别和语音识别等组件,标准化聊天机器人开发,支持企业 OA 智能问答、HR 智能问答、智能客服和网络营销等场景。企业 IT 部门、业务部门借助 Chatopera 云服务快速让聊天机器人上线! <details> <summary>展开查看 Chatopera 云服务的产品截图</summary> <p> <p align="center"> <b>自定义词典</b><br> <img src="https://static-public.chatopera.com/assets/images/64530072-da92d600-d33e-11e9-8656-01c26caff4f9.png" width="800"> </p> <p align="center"> <b>自定义词条</b><br> <img src="https://static-public.chatopera.com/assets/images/64530091-e41c3e00-d33e-11e9-9704-c07a2a02b84e.png" width="800"> </p> <p align="center"> <b>创建意图</b><br> <img src="https://static-public.chatopera.com/assets/images/64530169-12018280-d33f-11e9-93b4-9db881cf4dd5.png" width="800"> </p> <p align="center"> <b>添加说法和槽位</b><br> <img src="https://static-public.chatopera.com/assets/images/64530187-20e83500-d33f-11e9-87ec-a0241e3dac4d.png" width="800"> </p> <p align="center"> <b>训练模型</b><br> <img src="https://static-public.chatopera.com/assets/images/64530235-33626e80-d33f-11e9-8d07-fa3ae417fd5d.png" width="800"> </p> <p align="center"> <b>测试对话</b><br> <img src="https://static-public.chatopera.com/assets/images/64530253-3d846d00-d33f-11e9-81ea-86e6d47020d8.png" width="800"> </p> <p align="center"> <b>机器人画像</b><br> <img src="https://static-public.chatopera.com/assets/images/64530312-6442a380-d33f-11e9-869c-85fb6a835a97.png" width="800"> </p> <p align="center"> <b>系统集成</b><br> <img src="https://static-public.chatopera.com/assets/images/64530281-4ecd7980-d33f-11e9-8def-c53251f30138.png" width="800"> </p> <p align="center"> <b>聊天历史</b><br> <img src="https://static-public.chatopera.com/assets/images/64530295-5856e180-d33f-11e9-94d4-db50481b2d8e.png" width="800"> </p> <p align="center"> <b>立即使用</b><br> <a href="https://bot.chatopera.com" target="_blank"> <img src="https://static-public.chatopera.com/assets/images/64531083-3199aa80-d341-11e9-86cd-3a3ed860b14b.png" width="800"> </a> </p> </p> </details> ## 主题演讲 | 时间 | 活动 | 链接 | 时长 | 概述 | | ---------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- | ------ | ----------------------------------- | | 2019-12-14 | [Microsoft AI Bootscamp(2019)](https://github.com/huan/microsoft-ai-bootcamp) | [回放](https://www.bilibili.com/video/av80153181?p=3) | 40mins | 基本使用介绍+支持正则表达式词典 | | 2019-11-03 | [COSCon '2019 中国开源年会](https://www.bagevent.com/event/5744455) | [回放](https://v.qq.com/x/page/u3017ka4t6o.html), [PPT【提取码: 25ni】](https://pan.baidu.com/s/1Z-d6CMtI782TLHRxaklDcw) | 40mins | 基本使用介绍+支持读取文件训练机器人 | | 2019-09-26 | CSDN 学院直播:深度学习之智能问答机器人实战 | [回放](https://edu.csdn.net/huiyiCourse/detail/1068) | 60mins | 基本使用介绍 | ## 用户交流群 <p align="center"> <b>在 Chatopera 客户群中也包括其他用户,请不要发送敏感信息。讨论与 Chatopera 产品和服务相关的事宜</b><br> <img src="https://static-public.chatopera.com/assets/images/Chatopera_wecom_customer_group_qr.png" width="600"> </p> ## 媒体报道 - [开源中国:语义理解系统 Clause](https://www.oschina.net/p/clause) - [我爱自然语言处理:Clause,开源的语义理解服务](http://www.52nlp.cn/clause-oss) ## 特别鸣谢 - [Lexical Analysis of Chinese](https://github.com/baidu/lac): Baidu's open-source lexical analysis tool for Chinese, including word segmentation, part-of-speech tagging & named entity recognition. - [CRFsuite](https://github.com/chokkan/crfsuite): a fast implementation of Conditional Random Fields (CRFs) - [Xapian](https://xapian.org/): an Open Source Search Engine Library # 自然语言处理推荐入门&工具书 机器学习 & 自然语言处理入门指南,本书由 [Clause](https://github.com/chatopera/clause) 作者参与著作。 <p align="center"> <b>快速购书<a href="https://search.jd.com/Search?keyword=%E6%99%BA%E8%83%BD%E9%97%AE%E7%AD%94%E4%B8%8E%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0&enc=utf-8&wq=%E6%99%BA%E8%83%BD%E9%97%AE%E7%AD%94%E4%B8%8E%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0" target="_blank">链接</a></b><br> <a href="https://search.jd.com/Search?keyword=%E6%99%BA%E8%83%BD%E9%97%AE%E7%AD%94%E4%B8%8E%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0&enc=utf-8&wq=%E6%99%BA%E8%83%BD%E9%97%AE%E7%AD%94%E4%B8%8E%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0" target="_blank"> <img src="https://user-images.githubusercontent.com/3538629/48657619-bcd24880-ea6e-11e8-8c4e-8bcb00761942.png" width="400"> </a> </p> [《智能问答与深度学习》](https://search.jd.com/Search?keyword=%E6%99%BA%E8%83%BD%E9%97%AE%E7%AD%94%E4%B8%8E%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0&enc=utf-8&wq=%E6%99%BA%E8%83%BD%E9%97%AE%E7%AD%94%E4%B8%8E%E6%B7%B1%E5%BA%A6%E5%AD%A6%E4%B9%A0) 这本书是服务于准备入门机器学习和自然语言处理的学生和软件工程师的,在理论上介绍了很多原理、算法,同时也提供很多示例程序增加实践性,这些程序被汇总到示例程序代码库,这些程序主要是帮助大家理解原理和算法的,欢迎大家下载和执行。代码库的地址是: [https://github.com/l11x0m7/book-of-qna-code](https://github.com/l11x0m7/book-of-qna-code) ## 开源许可协议 Copyright (2019-2020) <a href="https://www.chatopera.com/" target="_blank">北京华夏春松科技有限公司</a> [Apache License Version 2.0](https://github.com/chatopera/clause/blob/master/LICENSE) [![chatoper banner][co-banner-image]][co-url] [co-banner-image]: https://static-public.chatopera.com/assets/images/42383104-da925942-8168-11e8-8195-868d5fcec170.png [co-url]: https://www.chatopera.com

AI Agents ML Frameworks
409 Github Stars