1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +03:00

Correct the 📝 for decorateTermWithFeatureVector.

This commit is contained in:
Rob Rix 2016-08-09 11:08:44 -04:00
parent c484a2c8fc
commit d255e16808

View File

@ -93,7 +93,7 @@ decorateTermWithPQGram p q = cata algebra . decorateTermWithPGram p
put (drop 1 labels)
pure $! cofree ((gram { base = padToSize q labels } .: rest) :< functor)))
-- | Replaces bags of p,q-grams in a terms annotations with corresponding feature vectors.
-- | Replaces a p,q-gram at the head of a terms annotation with corresponding feature vectors.
decorateTermWithFeatureVector :: (Hashable label, Prologue.Foldable f, Functor f) => Int -> Cofree f (Record (Gram label ': fields)) -> Cofree f (Record (Vector.Vector Double ': fields))
decorateTermWithFeatureVector d = cata $ \ (RCons gram rest :< functor) ->
cofree ((foldr (Vector.zipWith (+) . getField . extract) (unitVector d (hash gram)) functor .: rest) :< functor)