NLP神经网络研究项目。
使用Pytorch和Spacy实施。
启发者:https://www.youtube.com/watch?v=rpwenzfsuhw&list=ll&index=37
安装指南
Pytorch安装说明Pytorch网站Spacy安装说明Spacy网站
1。安装pytorch
安装PyTorch
$pip3 install torch torchvision torchaudio --index-url https://download.pyto***rch.org/whl/cu1172。安装旋转和依赖关系
用于Spacy NLP库安装:
安装设置工具:
$pip install -U pip setuptools wheel安装spaCy NLP库:
$pip install -U spacy添加模型:
$python -m spacy download en_core_web_md特征
- 能够使用NLP技术(例如令牌化,lemmatization等)预处理文本。
- 使用Pytorch实施Feed向前神经网络模型。
- 修改JSON文件或通过API注入JSON以训练模型。
- 添加自定义标签并使用自定义组件和命名实体识别模式(NER)修改NLP管道
- 能够交易“单词袋”并用单词向量等等。
- 将扩展用例测试不同的NLP技术。
- 构建API以在游戏中创建动态的NPC字符。
技术堆栈
技术使用的技术使用:
- Python3-高级编程语言
- Pytorch-机器学习框架
- spacy.io-工业强度自然语言处理库
定制
看看数据/培训数据。您可以根据自己的用例自定义。只需定义一个新tag ,可能的patterns和可能的AI responses即可。
{
" intents " : [
{
" tag " : " greeting " ,
" patterns " : [
" Hi " ,
" Hey " ,
" How are you " ,
" Is anyone there? " ,
" Hello " ,
" Good day "
],
" responses " : [
" Hey :-) " ,
" Hello, thanks for visiting " ,
" Hi there, what can I do for you? " ,
" Hi there, how can I help? "
]
},
...
]
}每当修改此文件时,您都必须重新运行培训。在main.py文件中,只需切换training_required bool到True
import spacy
from processor import DataProcessor
from chat import ChatBot
nlp = spacy.load( ' en_core_web_md ' )
# NOTE: toggle if you want to retrain the model
training_required: bool = False
# create NLP model object and pass it the text from file
data = DataProcessor(training_required)
# perform NLP pipeline process and return the updated data processor object
data_processor = data.initialise_data ()
# setup chatbot interface
chatbot = ChatBot(data_processor)
chatbot.create_chat ()执照
麻省理工学院
下载源码
通过命令行克隆项目:
git clone https://github.com/jamesvovos/nlp-neural-network-project.git