Esempio n. 1
0
        // In this method, each tag that is incompatible with the current word
        // (e.g., apple_CC) gets a default (constant) score instead of its exact score.
        // The scores of all other tags are computed exactly.
        private double[] GetApproximateScores(History h)
        {
            string[] tags   = StringTagsAt(h.current - h.start + LeftWindow());
            double[] scores = GetHistories(tags, h);
            // log score for each active tag, unnormalized
            // Number of tags that get assigned a default score:
            int    nDefault             = maxentTagger.ySize - tags.Length;
            double logScore             = ArrayMath.LogSum(scores);
            double logScoreInactiveTags = maxentTagger.GetInactiveTagDefaultScore(nDefault);
            double logTotal             = SloppyMath.LogAdd(logScore, logScoreInactiveTags);

            ArrayMath.AddInPlace(scores, -logTotal);
            return(scores);
        }