Closed caozhen-alex closed 5 years ago
Line 127 checks whether a key (token in the expected response) appears in the input. If so creates record the location (loc) into an array.
Excuse me, I don't understand why the code is "val[0]" instead of "val" ? For example, in the NMT task, "Ask Tom. Demande à Tom.", "Tom" is a key that appears in the input. However, since key = "Tom" and val = "Tom", that val[0] = "T" ≠ key and wouldn't record the location (loc) into an array.
Hi @James-Yip ,
I checked the code and yes please remove the [0] in the code. We take the first element because in the dialogue setting, we put triplets format, (subject, predicate, object), in the memory. Therefore we will need to indicate the index. However, in the MT setting, it is just a plain string array so no need to take [0] in this case. Sorry for the misleading.
One last thing, copy mechanism might not be that helpful in MT case because the input and output are not in the same language (different vocabulary). So directly use Mem2Seq in MT problems will not give you promising results. Or you might want to try BPE.
Let me know if there is any other question.
@jasonwu0731 Thanks. One more question: What about using Mem2Seq on question answering task(just QA-pairs)? If I add some professional articles that help to answer questions as external memory. Would they help? And I worry about the speed if I add them (since there're 100+ articles).
Yes I believe is doable. Cause using Mem2Seq to encode the articles as external knowledge could be useful. If you are afraid of the size of articles, maybe you can filter them using some retrieval methods (ex: tf-idf) and then put in the memory networks.
I got it. Thank you so much! I will have a try. @jasonwu0731
Hi, what does this line do here? https://github.com/HLTCHKUST/Mem2Seq/blob/84a2ccdb3255680ee19c3b94985517e8718ced65/utils/utils_NMT.py#L127 And what's the meaning of
cnt_ptr
,cnt_voc
,ptr_index
,max_r_len
?