graykode / graykode/nlp-tutorial

3-3.Bi-LSTM may have wrong padding

Open
#72 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
14.9k
Forks
3.9k
PR merge metrics
No merged PRs in 30d

Description

In line 16 you use
` input = input + [0] * (max_len - len(input))`
the padding, you use 0, which means the first word 'Lorem'.
but it is not the right choose.
I think you can change like that
```
# word_dict = {w: i for i, w in enumerate(list(set(sentence.split())))}
# number_dict = {i: w for i, w in enumerate(list(set(sentence.split())))}
word_dict = {w: i for i, w in enumerate(['PAD']+list(set(sentence.split())))}
number_dict = {i: w for i, w in enumerate(['PAD']+list(set(sentence.split())))}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.