You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
我找了一下发现这个问题出错在 predict函数里面的tensorfromsentence。 他把“是谁”直接传进tensorfromsentence,然后进到indexesFromSentence。这里会有一个问题:
return [lang.word2index[word] for word in sentence.split(' ')]
“是谁”在Lang dataset里面被jieba拆成“是”和“谁”, 这里sentence.split(' ')并不会把“是谁”拆开。所以我觉得在predict之前得先给input分词。
我跑的是seq2seq pytorch的。 我在跑app发现了一个问题。
跑app之前我先训练了1000遍, 确定了前1000个句子被读进去了。但是跑之后传了一个“是谁”, 他给出了keyerror“是谁”。
我找了一下发现这个问题出错在 predict函数里面的tensorfromsentence。 他把“是谁”直接传进tensorfromsentence,然后进到indexesFromSentence。这里会有一个问题:
return [lang.word2index[word] for word in sentence.split(' ')]
“是谁”在Lang dataset里面被jieba拆成“是”和“谁”, 这里sentence.split(' ')并不会把“是谁”拆开。所以我觉得在predict之前得先给input分词。
我是先把传进来的input:
input = " ".join(jieba.cut(input))
然后再运行tensorfromsentence就应该没问题了
The text was updated successfully, but these errors were encountered: