Skip to content

It is throwing errors for some words I think it hasn't endountered. #1

@SumanthSrungavarapu

Description

@SumanthSrungavarapu

The input and the error was as follows. Same error is occuring if the input has words like names (example words: google,raja etc,.)
Is there any around this?

C:\Users\suman\Desktop\Transformer-Multi-Language-Translator>python translate.py --input_text "For this project, the European Parliament Proceedings Parallel Corpus 1996-2011 is used. Note, the downloaded files are tgz files. In order to use them, please extract them and name them according to the format you see in this repo, including appropriately expanding names for convenient access." --input_lang english --output_lang french
Traceback (most recent call last):
File "C:\Users\suman\Desktop\Transformer-Multi-Language-Translator\translate.py", line 116, in
main()
File "C:\Users\suman\Desktop\Transformer-Multi-Language-Translator\translate.py", line 110, in main
translation, attention = translate_sentence(input_text, input_lang_dic, output_lang_dic, translator, device, MAX_LENGTH)
File "C:\Users\suman\Desktop\Transformer-Multi-Language-Translator\translate.py", line 22, in translate_sentence
tokens = tokenize(normalized_sentence, input_dic)
File "C:\Users\suman\Desktop\Transformer-Multi-Language-Translator\utilities.py", line 79, in tokenize
token += [dictionary.word2index[word] for word in sentence.split(' ')]
File "C:\Users\suman\Desktop\Transformer-Multi-Language-Translator\utilities.py", line 79, in
token += [dictionary.word2index[word] for word in sentence.split(' ')]
KeyError: 'downloaded'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions