hankcs / hankcs/AveragedPerceptronPython

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

Open
#1 2 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
Python
Stars
50
Forks
29
PR merge metrics
No merged PRs in 30d

Description

你好,我想请教一下[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
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.