diff --git a/src/Data/RandomWalkSimilarity.hs b/src/Data/RandomWalkSimilarity.hs index 8e4560113..31ad0e977 100644 --- a/src/Data/RandomWalkSimilarity.hs +++ b/src/Data/RandomWalkSimilarity.hs @@ -1,7 +1,6 @@ {-# LANGUAGE DataKinds, GADTs, RankNTypes, TypeOperators #-} module Data.RandomWalkSimilarity ( rws -, pqGrams , featureVector , pqGramDecorator , featureVectorDecorator @@ -62,11 +61,6 @@ data UnmappedTerm a = UnmappedTerm { termIndex :: {-# UNPACK #-} !Int, feature : data Gram label = Gram { stem :: [Maybe label], base :: [Maybe label] } deriving (Eq, Show) --- | Compute the bag of grams with stems of length _p_ and bases of length _q_, with labels computed from annotations, which summarize the entire subtree of a term. -pqGrams :: Traversable f => (forall b. CofreeF f (Record fields) b -> label) -> Int -> Int -> Cofree f (Record fields) -> DList.DList (Gram label) -pqGrams getLabel p q = foldMap (pure . getField) . pqGramDecorator getLabel p q - - -- | Compute a vector with the specified number of dimensions, as an approximation of a bag of `Gram`s summarizing a tree. featureVector :: Hashable label => Int -> DList.DList (Gram label) -> Vector.Vector Double featureVector d bag = sumVectors $ unitVector d . hash <$> bag