Skip to content

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

Description

@flystarhe

你好,我想请教一下200行Python代码实现感知机词性标注器中【搜索】哪一节中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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions