mirror of
https://github.com/github/semantic.git
synced 2024-12-28 17:32:05 +03:00
Rename Data.Gram to Data.RandomWalkSimilarity.
This commit is contained in:
parent
108decbcaa
commit
1170bfdcb2
@ -18,8 +18,8 @@ library
|
||||
, Category
|
||||
, Data.Bifunctor.Join.Arbitrary
|
||||
, Data.Functor.Both
|
||||
, Data.Gram
|
||||
, Data.Gram.Arbitrary
|
||||
, Data.RandomWalkSimilarity
|
||||
, Data.RandomWalkSimilarity.Arbitrary
|
||||
, Data.OrderedMap
|
||||
, Data.Record
|
||||
, Data.These.Arbitrary
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Data.Gram where
|
||||
module Data.RandomWalkSimilarity where
|
||||
|
||||
import Control.Monad.Random
|
||||
import qualified Data.DList as DList
|
@ -1,7 +1,7 @@
|
||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||
module Data.Gram.Arbitrary where
|
||||
module Data.RandomWalkSimilarity.Arbitrary where
|
||||
|
||||
import Data.Gram
|
||||
import Data.RandomWalkSimilarity
|
||||
import Prologue
|
||||
import Test.QuickCheck
|
||||
|
@ -1,8 +1,8 @@
|
||||
module Data.Gram.Spec where
|
||||
module Data.RandomWalkSimilarity.Spec where
|
||||
|
||||
import Data.DList as DList hiding (toList)
|
||||
import Data.Gram
|
||||
import Data.Gram.Arbitrary ()
|
||||
import Data.RandomWalkSimilarity
|
||||
import Data.RandomWalkSimilarity.Arbitrary ()
|
||||
import Data.String
|
||||
import Prologue
|
||||
import Term
|
||||
|
25
test/Data/RandomWalkSimilarity/Spec.hs
Normal file
25
test/Data/RandomWalkSimilarity/Spec.hs
Normal file
@ -0,0 +1,25 @@
|
||||
module Data.RandomWalkSimilarity.Spec where
|
||||
|
||||
import Data.DList as DList hiding (toList)
|
||||
import Data.RandomWalkSimilarity
|
||||
import Data.RandomWalkSimilarity.Arbitrary ()
|
||||
import Data.String
|
||||
import Prologue
|
||||
import Term
|
||||
import Term.Arbitrary
|
||||
import Test.Hspec
|
||||
import Test.Hspec.QuickCheck
|
||||
import Test.QuickCheck hiding (Fixed)
|
||||
|
||||
spec :: Spec
|
||||
spec = parallel $ do
|
||||
describe "pqGrams" $ do
|
||||
prop "produces grams with stems of the specified length" $ forAll (arbitrary `suchThat` (\ (_, p, q) -> p > 0 && q > 0)) $
|
||||
\ (term, p, q) -> pqGrams p q (toTerm term :: Term String String) `shouldSatisfy` all ((== p) . length . stem)
|
||||
|
||||
prop "produces grams with bases of the specified length" $ forAll (arbitrary `suchThat` (\ (_, p, q) -> p > 0 && q > 0)) $
|
||||
\ (term, p, q) -> pqGrams p q (toTerm term :: Term String String) `shouldSatisfy` all ((== q) . length . base)
|
||||
|
||||
describe "featureVector" $ do
|
||||
prop "produces a vector of the specified dimension" $ forAll (arbitrary `suchThat` ((> 0) . snd)) $
|
||||
\ (grams, d) -> length (featureVector (fromList (grams :: [Gram String])) d) `shouldBe` d
|
@ -3,7 +3,7 @@ module Main where
|
||||
import Prologue
|
||||
import qualified AlignmentSpec
|
||||
import qualified CorpusSpec
|
||||
import qualified Data.Gram.Spec
|
||||
import qualified Data.RandomWalkSimilarity.Spec
|
||||
import qualified DiffSummarySpec
|
||||
import qualified InterpreterSpec
|
||||
import qualified OrderedMapSpec
|
||||
@ -15,7 +15,7 @@ main :: IO ()
|
||||
main = hspec . parallel $ do
|
||||
describe "Alignment" AlignmentSpec.spec
|
||||
describe "Corpus" CorpusSpec.spec
|
||||
describe "Data.Gram" Data.Gram.Spec.spec
|
||||
describe "Data.RandomWalkSimilarity" Data.RandomWalkSimilarity.Spec.spec
|
||||
describe "DiffSummary" DiffSummarySpec.spec
|
||||
describe "Interpreter" InterpreterSpec.spec
|
||||
describe "OrderedMap" OrderedMapSpec.spec
|
||||
|
Loading…
Reference in New Issue
Block a user