-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[20220613][init][scope]all;desc init this project
- Loading branch information
0 parents
commit bc0bb2f
Showing
59 changed files
with
39,224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# for Dev | ||
*.db | ||
*.db-shm | ||
*.db-wal | ||
*.log | ||
*.json | ||
bin_data/total_word_feature_extractor.dat | ||
models/*.tar.gz | ||
*.tar.gz | ||
|
||
# for IDE | ||
.idea | ||
|
||
# for python | ||
__pycache__/* | ||
log | ||
models | ||
.rasa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
## 训练 Rasa 模型 | ||
```bash | ||
rasa train | ||
``` | ||
|
||
##启动Rasa服务器和客户端 | ||
```bash | ||
rasa shell | ||
``` | ||
|
||
```buildoutcfg | ||
rasa run --enable-api --verbose | ||
``` | ||
|
||
```buildoutcfg | ||
paddlespeech_server start --config_file ./conf/tts_online_application.yaml | ||
``` | ||
|
||
尝试输入一些查询,例如“如何检查面试结果?” 并查看回复。 | ||
|
||
玩得开心! | ||
|
||
|
||
|
||
## 功能 | ||
|
||
+ 查询武将、城池与势力等单体的属性,总体情况 | ||
+ 武将各属性: 如诸葛亮的出生地在哪,张飞的武力是多少, 陈宫的智力有80吗, 关于的枪兵能力怎么样, 刘备的特技是什么等 | ||
+ 城池各属性: 洛阳的武将都有谁, 开封有多少钱, 与长安相邻的城市有哪些等 | ||
+ 势力各属性: 李渊势力有多少武将, 刘邦的军师是谁,赵匡胤有多少个城池 | ||
+ 查询总体情况: | ||
+ 姓刘的都有谁 | ||
+ 成吉思汗哪个属性最弱 | ||
+ 司马懿的哪个兵种最强 | ||
+ 金钱超过8000的都有哪些城市、势力 | ||
+ 武力超过80的都有谁 | ||
+ 当前还有几个势力 | ||
+ 哪个势力钱最多 | ||
+ 哪个城市最富有 | ||
+ 哪里马最多 | ||
+ 长安是谁的势力范围 | ||
+ 双条件查询: | ||
+ 曹操手下姓张的有谁 | ||
+ 朱元璋手下政治最高的是谁 | ||
+ 谁的统帅与武力都超过80? | ||
+ 出生在洛阳的人中,谁的智力最高 | ||
+ 秦的城池中,哪个最穷? | ||
+ 比较: | ||
+ 关羽与赵云谁的武力高; | ||
+ 徐达的枪兵有李世民的厉害吗 | ||
+ 洛阳与寿春比,谁的马匹更多 | ||
+ 刘备与刘邦比谁的城多? | ||
+ 梓潼相邻城的数量有没有江夏的多 | ||
+ 最短路径: | ||
+ 从襄阳到柴桑需要经过几个城市 | ||
|
||
|
||
|
||
|
||
|
||
``` | ||
python的webrtc库实现语音端点检测: | ||
https://blog.csdn.net/u012123989/article/details/72771667 | ||
https://github.com/wangshub/python-vad | ||
DNN based hotword and wake word detection toolkit | ||
https://github.com/seasalt-ai/snowboy | ||
树莓派-语音聊天机器人实现 | ||
http://www.chenjianqu.com/show-42.html | ||
``` | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,204 @@ | ||
import typing | ||
from typing import Any, Dict, List, Text | ||
from rasa_sdk import Action, Tracker | ||
from rasa_sdk.events import SlotSet | ||
from rasa_sdk.executor import CollectingDispatcher | ||
from rasa_sdk import utils | ||
from chitchat_response import CDial | ||
|
||
if typing.TYPE_CHECKING: # pragma: no cover | ||
from rasa_sdk.types import DomainDict | ||
|
||
from process_data.keymap import * | ||
from process_data.neokb import SearchDB | ||
|
||
kb = SearchDB() | ||
unrelated_lm = CDial() # unrelated_lm: unrelated language model response generator | ||
|
||
|
||
class ActionPersonIntro(Action): | ||
def __init__(self, ): | ||
pass | ||
|
||
def name(self) -> Text: | ||
return "action_person_intro" | ||
|
||
async def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: "DomainDict", | ||
) -> List[Dict[Text, Any]]: | ||
entity = tracker.get_slot('person') | ||
if entity: | ||
obj = await utils.call_potential_coroutine( | ||
kb.person(entity) | ||
) | ||
texts = [f'{inv_person_map.get(k)}:{v}' for k, v in obj.items() if inv_person_map.get(k)] | ||
texts = ','.join(texts) | ||
texts = entity + ' ' + texts | ||
dispatcher.utter_message(texts) | ||
return [] | ||
|
||
dispatcher.utter_message(response="utter_ask_rephrase") | ||
return [] | ||
|
||
|
||
class ActionCityIntro(Action): | ||
def __init__(self, ): | ||
pass | ||
|
||
def name(self) -> Text: | ||
return "action_city_intro" | ||
|
||
async def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: "DomainDict", | ||
) -> List[Dict[Text, Any]]: | ||
entity = tracker.get_slot('city') | ||
if entity: | ||
obj = await utils.call_potential_coroutine( | ||
kb.city(entity) | ||
) | ||
texts = [f'{inv_city_map.get(k)}:{v}' for k, v in obj.items() if inv_city_map.get(k)] | ||
texts = ','.join(texts) | ||
texts = entity + ' ' + texts | ||
dispatcher.utter_message(texts) | ||
return [] | ||
|
||
dispatcher.utter_message(response="utter_ask_rephrase") | ||
return [] | ||
|
||
|
||
class ActionForceIntro(Action): | ||
def __init__(self, ): | ||
pass | ||
|
||
def name(self) -> Text: | ||
return "action_force_intro" | ||
|
||
async def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: "DomainDict", | ||
) -> List[Dict[Text, Any]]: | ||
entity = tracker.get_slot('force') | ||
if entity: | ||
obj = await utils.call_potential_coroutine( | ||
kb.force(entity) | ||
) | ||
texts = [f'{inv_force_map.get(k)}:{v}' for k, v in obj.items() if inv_force_map.get(k)] | ||
texts = ','.join(texts) | ||
texts = entity + ' ' + texts | ||
dispatcher.utter_message(texts) | ||
return [] | ||
|
||
dispatcher.utter_message(response="utter_ask_rephrase") | ||
return [] | ||
|
||
|
||
class ActionPersonAttr(Action): | ||
def __init__(self, ): | ||
pass | ||
|
||
def name(self) -> Text: | ||
return "action_person_attr" | ||
|
||
async def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: "DomainDict", | ||
) -> List[Dict[Text, Any]]: | ||
entity = tracker.get_slot('force') | ||
if entity: | ||
obj = await utils.call_potential_coroutine( | ||
kb.person(entity) | ||
) | ||
texts = [f'{inv_force_map.get(k)}:{v}' for k, v in obj.items() if inv_force_map.get(k)] | ||
texts = ','.join(texts) | ||
texts = entity + ' ' + texts | ||
dispatcher.utter_message(texts) | ||
return [] | ||
|
||
dispatcher.utter_message(response="utter_ask_rephrase") | ||
return [] | ||
|
||
|
||
class ActionCityAttr(Action): | ||
def __init__(self, ): | ||
pass | ||
|
||
def name(self) -> Text: | ||
return "action_city_attr" | ||
|
||
async def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: "DomainDict", | ||
) -> List[Dict[Text, Any]]: | ||
entity = tracker.get_slot('force') | ||
if entity: | ||
obj = await utils.call_potential_coroutine( | ||
kb.person(entity) | ||
) | ||
texts = [f'{inv_force_map.get(k)}:{v}' for k, v in obj.items() if inv_force_map.get(k)] | ||
texts = ','.join(texts) | ||
texts = entity + ' ' + texts | ||
dispatcher.utter_message(texts) | ||
return [] | ||
|
||
dispatcher.utter_message(response="utter_ask_rephrase") | ||
return [] | ||
|
||
|
||
class ActionForceAttr(Action): | ||
def __init__(self, ): | ||
pass | ||
|
||
def name(self) -> Text: | ||
return "action_force_attr" | ||
|
||
async def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: "DomainDict", | ||
) -> List[Dict[Text, Any]]: | ||
entity = tracker.get_slot('force') | ||
if entity: | ||
obj = await utils.call_potential_coroutine( | ||
kb.person(entity) | ||
) | ||
texts = [f'{inv_force_map.get(k)}:{v}' for k, v in obj.items() if inv_force_map.get(k)] | ||
texts = ','.join(texts) | ||
texts = entity + ' ' + texts | ||
dispatcher.utter_message(texts) | ||
return [] | ||
|
||
dispatcher.utter_message(response="utter_ask_rephrase") | ||
return [] | ||
|
||
|
||
class ActionUnrelated(Action): | ||
def __init__(self, ): | ||
pass | ||
|
||
def name(self) -> Text: | ||
return "action_unrelated_topic" | ||
|
||
async def run( | ||
self, | ||
dispatcher: CollectingDispatcher, | ||
tracker: Tracker, | ||
domain: "DomainDict", | ||
) -> List[Dict[Text, Any]]: | ||
raw_text = tracker.latest_message | ||
texts = unrelated_lm.response(raw_text) | ||
dispatcher.utter_message(response=texts) | ||
# dispatcher.utter_message(response="utter_ask_rephrase") | ||
return [] |
Empty file.
Oops, something went wrong.