get alignments using attention #138
Description
Hi,
With a trained model checkpoint, I evaluated it on a set of 'test' sentences. In the result, I get some <unk>
tokens in translated sentences. Now, I'd like to solve this issue by figuring out which words in source sentence caused these unk
tokens.
For this, as far as I understand, we can use the attention mechanism
to get the word alignments? But, I'm not sure where exactly I should start doing this in the current NMT codebase. could someone please point out the exact point where such an implementation can be done?
Or is there any other way to get the alignment of words?
Interestingly, a dictionary can be extracted from alignment with scores as mentioned here: En-Vi alignment dictionary
It'd be nice to know how to get this dictionary. Maybe @lmthang can offer suggestions please?
Thanks!