You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virtual-patient/virtual-patient-rasa/README.md

52 lines
1.6 KiB
Markdown

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#### rasa镜像版本说明
| 镜像名称 | 镜像版本 |镜像id| 说明 |
|----------|-------| --- |-------------------------|
| rasa_dev | 1.0.0 | 365fe9f00bac | rasa镜像基础版本只包含必要的rasa服务 |
| rasa_dev | 1.1.0 | | 在1.0.0的基础上添加text2vec服务 |
| rasa_dev | 2.0.0 | 22313f228098 | 添加rasa-java服务 |
# 文本相似度匹配应用程序
> 这个应用程序使用 text2vec 进行文本相似度匹配,允许用户更新数据集并查询最佳匹配项。
## 安装依赖
```bash
创建环境
conda create text2vec_env python=3.9
进入环境
conda activate text2vec_env
```
```bash
pip install torch
pip install flask
pip install text2vec -i https://pypi.tuna.tsinghua.edu.cn/simple
```
启动应用程序
``` bash
python app.py
```
应用程序将在 http://127.0.0.1:5000/ 上运行。
# API文档
```
API 文档:
1. 更新数据集
- 端点: /update_dataset
- 方法: POST
- 输入: JSON [{"id": "101","question": "你好"},{"id": "541","question": "你好吗?"}]
- 输出: JSON {"status": "success", "message": "数据集更新成功"}
2. 获取匹配项
- 端点: /matches
- 方法: POST
- 输入: JSON {"querySentence": "查询句子", "threshold": 0.7}
- 输出: JSON {"status": "success", "results": [{"id": 1, "sentence": "匹配的句子", "similarity": 0.75}]}
3. 获取所有相似度
- 端点: /get_all_similarities
- 方法: POST
- 输入: JSON {"querySentence": "查询句子"}
- 输出: JSON {"status": "success", "results": [{"id": 1, "sentence": "句子1", "similarity": 0.8}]}
```