graykode / graykode/nlp-tutorial

3-3.Bi-LSTM may have wrong padding

Aperta
#72 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Jupyter Notebook
Stelle
14.9k
Fork
3.9k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.