mirror of
https://github.com/github/semantic.git
synced 2024-12-29 09:55:52 +03:00
Rename Data.Gram to Data.RandomWalkSimilarity.
This commit is contained in:
parent
108decbcaa
commit
1170bfdcb2
@ -18,8 +18,8 @@ library
|
|||||||
, Category
|
, Category
|
||||||
, Data.Bifunctor.Join.Arbitrary
|
, Data.Bifunctor.Join.Arbitrary
|
||||||
, Data.Functor.Both
|
, Data.Functor.Both
|
||||||
, Data.Gram
|
, Data.RandomWalkSimilarity
|
||||||
, Data.Gram.Arbitrary
|
, Data.RandomWalkSimilarity.Arbitrary
|
||||||
, Data.OrderedMap
|
, Data.OrderedMap
|
||||||
, Data.Record
|
, Data.Record
|
||||||
, Data.These.Arbitrary
|
, Data.These.Arbitrary
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Data.Gram where
|
module Data.RandomWalkSimilarity where
|
||||||
|
|
||||||
import Control.Monad.Random
|
import Control.Monad.Random
|
||||||
import qualified Data.DList as DList
|
import qualified Data.DList as DList
|
@ -1,7 +1,7 @@
|
|||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
module Data.Gram.Arbitrary where
|
module Data.RandomWalkSimilarity.Arbitrary where
|
||||||
|
|
||||||
import Data.Gram
|
import Data.RandomWalkSimilarity
|
||||||
import Prologue
|
import Prologue
|
||||||
import Test.QuickCheck
|
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.DList as DList hiding (toList)
|
||||||
import Data.Gram
|
import Data.RandomWalkSimilarity
|
||||||
import Data.Gram.Arbitrary ()
|
import Data.RandomWalkSimilarity.Arbitrary ()
|
||||||
import Data.String
|
import Data.String
|
||||||
import Prologue
|
import Prologue
|
||||||
import Term
|
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 Prologue
|
||||||
import qualified AlignmentSpec
|
import qualified AlignmentSpec
|
||||||
import qualified CorpusSpec
|
import qualified CorpusSpec
|
||||||
import qualified Data.Gram.Spec
|
import qualified Data.RandomWalkSimilarity.Spec
|
||||||
import qualified DiffSummarySpec
|
import qualified DiffSummarySpec
|
||||||
import qualified InterpreterSpec
|
import qualified InterpreterSpec
|
||||||
import qualified OrderedMapSpec
|
import qualified OrderedMapSpec
|
||||||
@ -15,7 +15,7 @@ main :: IO ()
|
|||||||
main = hspec . parallel $ do
|
main = hspec . parallel $ do
|
||||||
describe "Alignment" AlignmentSpec.spec
|
describe "Alignment" AlignmentSpec.spec
|
||||||
describe "Corpus" CorpusSpec.spec
|
describe "Corpus" CorpusSpec.spec
|
||||||
describe "Data.Gram" Data.Gram.Spec.spec
|
describe "Data.RandomWalkSimilarity" Data.RandomWalkSimilarity.Spec.spec
|
||||||
describe "DiffSummary" DiffSummarySpec.spec
|
describe "DiffSummary" DiffSummarySpec.spec
|
||||||
describe "Interpreter" InterpreterSpec.spec
|
describe "Interpreter" InterpreterSpec.spec
|
||||||
describe "OrderedMap" OrderedMapSpec.spec
|
describe "OrderedMap" OrderedMapSpec.spec
|
||||||
|
Loading…
Reference in New Issue
Block a user