graykode / graykode/nlp-tutorial

3-3.Bi-LSTM may have wrong padding

オープン
#72 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Jupyter Notebook
スター
14.9k
フォーク
3.9k
PR マージ指標
30日以内にマージされた PR はありません

説明

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())))}
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。