Renamed intents for skills
This commit is contained in:
parent
53da5409b4
commit
7f7feb27e9
@ -37,7 +37,7 @@ def get_tag_for_sentence(input_sentence):
|
||||
----------
|
||||
input_sentence is your sentence
|
||||
|
||||
Returns tag from the intents.json file
|
||||
Returns tag from the skills.json file
|
||||
-------
|
||||
|
||||
"""
|
||||
|
@ -20,7 +20,7 @@ def train():
|
||||
all_words = []
|
||||
tags = []
|
||||
xy = []
|
||||
# loop through each sentence in our intents patterns
|
||||
# loop through each sentence in our skills patterns
|
||||
for intent in all_intents_patterns:
|
||||
tag = intent
|
||||
# add to tag list
|
||||
|
4
main.py
4
main.py
@ -24,8 +24,8 @@ def process_request():
|
||||
return jsonify("I didn't get that.")
|
||||
|
||||
path_of_intent = intents_utils.get_path(tag_for_request)
|
||||
path_of_intent = path_of_intent.split('/intents/')[1].replace('/', '.')
|
||||
path_of_intent = "intents." + path_of_intent + "intent"
|
||||
path_of_intent = path_of_intent.split('/skills/')[1].replace('/', '.')
|
||||
path_of_intent = "skills." + path_of_intent + "intent"
|
||||
|
||||
method = utils.import_method_from_string(path_of_intent, tag_for_request)
|
||||
return jsonify(method())
|
||||
|
@ -3,4 +3,5 @@ Unidecode~=1.2.0
|
||||
nltk~=3.6.2
|
||||
torch~=1.9.0
|
||||
numpy~=1.21.1
|
||||
requests~=2.26.0
|
||||
requests~=2.26.0
|
||||
adapt-parser
|
0
skills/entertainement/jokes/__init__.py
Normal file
0
skills/entertainement/jokes/__init__.py
Normal file
@ -15,11 +15,11 @@ def register_all_intents():
|
||||
|
||||
result = {}
|
||||
|
||||
files = glob.glob(path + "/intents/**/info.json", recursive=True)
|
||||
files = glob.glob(path + "/skills/**/info.json", recursive=True)
|
||||
for f in files:
|
||||
with open(f, "rb") as infile:
|
||||
intent_info_json = json.load(infile)
|
||||
intents_in_info = intent_info_json['intents']
|
||||
intents_in_info = intent_info_json['skills']
|
||||
intent_path = str(f).replace('info.json', '')
|
||||
|
||||
for intent in intents_in_info:
|
||||
|
@ -3,7 +3,7 @@ import importlib
|
||||
|
||||
def import_method_from_string(file, method_name):
|
||||
"""
|
||||
Add the posibility to import method dynamically using a string like "intents.daily.date_and_time.intent" as file and
|
||||
Add the possibility to import method dynamically using a string like "skills.daily.date_and_time.intent" as file and
|
||||
"what_time_is_it" as method_name
|
||||
"""
|
||||
mod = importlib.import_module(file)
|
||||
|
Reference in New Issue
Block a user