hankcs / hankcs/AveragedPerceptronPython

这里的`train`是更新条件遗漏了吗?

Aperta
#1 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
question
Lingua principale
Python
Stelle
50
Fork
29
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

你好,我想请教一下[200行Python代码实现感知机词性标注器](http://www.hankcs.com/nlp/averaged-perceptron-tagger.html)中【搜索】哪一节中`train`函数的一个问题:

文中前端说的是,当`guess != true_tag`时就更新权重(犯错时),第一个`train`出现的时候。可是【搜索】这一段中却总是在更新,是遗漏了吗?

```
guess = self.tagdict.get(word)
if not guess:
feats = self._get_features(
i, word, context, prev, prev2)
guess = self.model.predict(feats)
self.model.update(tags[i], guess, feats)
# Set the history features from the guesses, not the
# true tags
```

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.