我正在做其中一个教程(HelloWorld)为Echo制作技能,我按照指示操作.当我使用服务模拟器测试技能时,我输入了
Alexa, tell Greeter to say hello
Run Code Online (Sandbox Code Playgroud)
并返回以下JSON响应:
{
"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "Hello World!"
},
"card": {
"content": "Hello World!",
"title": "Greeter",
"type": "Simple"
},
"shouldEndSession": true
},
"sessionAttributes": {}
}
Run Code Online (Sandbox Code Playgroud)
我认为这是正确的输出.然而,当我尝试在我的Echo上测试技能时,Alexa回答"对不起,我没有你的问题." 我继续了历史,Alexa将我的命令解释为"alexa告诉greeter打个招呼".似乎Alexa没有认识到这项技能?
我正在使用Amazon Lambda来执行代码,因此我检查了日志,并且当我向上面讲述命令时代码未执行.
我将javascript文件中的app_id替换为与我的技能相对应的app_id.我也把亚马逊技能套件作为触发器.
我也尝试了其他教程(ChemistryFlashCards和HistoryBuff),Alexa回答说"我不确定你的意思."
不确定发生了什么!任何指导表示赞赏!!
我正在尝试使用加载的标记生成器对文本进行编码,但出现以下错误
AttributeError: 'Tokenizer' object has no attribute 'oov_token'
我添加了以下代码:
from keras.preprocessing.text import Tokenizer
from keras.preprocessing import sequence
from keras.models import Model, Input, Sequential, load_model
import pickle
import h5py
maxlen = 100
tok = open('tokenizer.pickle', 'rb')
tokenizer = pickle.load(tok)
tok.close()
model = load_model('weights.h5')
def predict():
new_text = sequence.pad_sequences((tokenizer.texts_to_sequences(['heyyyy'])), maxlen=maxlen)
prediction = model.predict(new_text,batch_size=1,verbose=2)
Run Code Online (Sandbox Code Playgroud)
问题出现在线路上tokenizer.texts_to_sequences(['heyyyy']),我不知道为什么。是不是泡菜有问题?tokenizer.texts_to_sequences与'hey'、'heyy'、 和 一起工作'heyyy'。
任何指导表示赞赏!