# lsr-front-end **Repository Path**: xiao-qirui/lsr-front-end ## Basic Information - **Project Name**: lsr-front-end - **Description**: lsr-front-end - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-09-05 - **Last Updated**: 2024-09-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README 基于Rasa构建面向家庭生活场景的的智能问答系统 #### 软件架构 软件架构说明 环境配置: - Rasa 2.0.0 - python 3.7 - neo4j 4.1 - JDK 11.0.8 - rasa-sdk==2.4.1 - tensorflow==2.3.2 软件架构说明: lsr-front-end ├── actions 自定义的动作 ├── conf 模型训练中的参数文件 ├── models 存放模型权重 ├── result 情感分析模型 ├── interact 交互文件 │ └── trainsfer_raw_to_rasa.py 数据格式转化脚本 │ └── asr.py 百度WebAP │ └── tts.py 百度WebAPI ├── main.py 主函数 ├── deploy.sh 安装依赖项的脚本文件 ├── config.yml 训练NLU和Core模型配置文件 ├── credentials.yml 配置请求Rasa Server ├── domain.yml 记录系统所有的信息 ├── endpoints.yml rasa server能够连接到其他web ├── sentiment.py 自定义情感分析组件 ├──data 存放训练数据等 │ └──nlu.json NLU训练数据 │ └──stories.md core训练数据 │ └── nlu_data.txt NLU原始数据 │ └── thanks.mp3 音频文件 ├──src 情感分析模型 │ └── model.py 模型构建文件 │ └── config.py 文件参数配置文件 │ └── preprocess.py 数据预处理 #### 安装教程 安装conda ```bash wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-4.3.14-Linux-x86_64.sh bash Miniconda3-4.3.14-Linux-x86_64.sh #安装完后重启终端,配置环境变量 vim ~/.bashrc #在最下行输入miniconda3的安装目录作为环境变量,与上面保存的安装目录相同, export PATH="/home/用户名/miniconda3/bin:"$PATH source ~/.bashrc #需要换源可以在网上自行搜索教程 ``` (1)MITIE 下载MITIE pip install git+https://github.com/mit-nlp/MITIE.git (2)安装中文分词模型 中文词向量模型total_word_feature_extractor_zh.dat( https://pan.baidu.com/share/init?surl=kNENvlHLYWZIddmtWJ7Pdg 密码:p4vx) 这里需要将total_word_feature_extractor_zh.dat模型拷贝到创建的rasa项目data目录下,后面训练NLU模型时用到。 (3)文本语义多模态情感分析数据集(链接:https://pan.baidu.com/s/1zkz9nP7jDi4dzxpqg8uAGg 提取码:40eu ) #安装依赖 首次在计算机上运行项目时,需要先安装所需的依赖软件: ```bash cd lsr-front-end sudo apt install dos2unix dos2unix deploy.sh ./deploy.sh -t ``` #### 使用说明 #训练模型 nlu core 同时训练(文件名称自定义的): ```bash python -m rasa train --config config.yml --domain domain.yml --data data/ --out models ``` 只训练nlu: ```bash python -m rasa train nlu --config config.yml --out models ``` 只训练core: ```bash python -m rasa train core --domain domain.yml --out models ``` #运行模型 启动neo4j ```bash $ cd /Users/neo4j-community-4.2.18 --到达neo4j目录 $ cd bin $ ./neo4j start --不用的时候需要关闭掉图数据库 $ ./neo4j stop #模型训练好之后,便可以启动Rasa API:测试API接口返回信息,在此期间需要把neo4j连接上。 rasa run --enable-api #rasa run actions Starts an action server using the Rasa SDK。 python -m rasa run actions --port 5055 --actions actions --debug ``` #### 参与贡献 1. 具体rasa运行和训练细节见博客:https://www.jianshu.com/p/07c87c63e83a 2. rasa环境配置参考博客 https://jiangdg.blog.csdn.net/article/details/104328946