Skip to content
This repository was archived by the owner on Dec 11, 2023. It is now read-only.
This repository was archived by the owner on Dec 11, 2023. It is now read-only.

get alignments using attention #138

Open
@kmario23

Description

@kmario23

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions