Copyright | (c) CNRS 2017-Present |
---|---|
License | AGPL + CECILL v3 |
Maintainer | team@gargantext.org |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Ngrams connection to the Database.
Synopsis
- type NgramsId = Int
- type Size = Int
- data NgramsPoly id terms n = NgramsDB {
- _ngrams_id :: !id
- _ngrams_terms :: !terms
- _ngrams_n :: !n
- type NgramsWrite = NgramsPoly (Maybe (Field SqlInt4)) (Field SqlText) (Field SqlInt4)
- type NgramsRead = NgramsPoly (Field SqlInt4) (Field SqlText) (Field SqlInt4)
- type NgramsDB = NgramsPoly Int Text Int
- pNgramsDb :: forall p a1_0 a2_0 a3_0 a1_1 a2_1 a3_1. ProductProfunctor p => NgramsPoly (p a1_0 a1_1) (p a2_0 a2_1) (p a3_0 a3_1) -> p (NgramsPoly a1_0 a2_0 a3_0) (NgramsPoly a1_1 a2_1 a3_1)
- ngrams_terms :: forall id terms n terms. Lens (NgramsPoly id terms n) (NgramsPoly id terms n) terms terms
- ngrams_n :: forall id terms n n. Lens (NgramsPoly id terms n) (NgramsPoly id terms n) n n
- ngrams_id :: forall id terms n id. Lens (NgramsPoly id terms n) (NgramsPoly id terms n) id id
- ngramsTable :: Table NgramsWrite NgramsRead
- text2ngrams :: Text -> Ngrams
- newtype NgramsTypeId = NgramsTypeId Int
- pgNgramsType :: NgramsType -> Field SqlInt4
- pgNgramsTypeId :: NgramsTypeId -> Field SqlInt4
- ngramsTypeIds :: Bimap NgramsType NgramsTypeId
- fromNgramsTypeId :: NgramsTypeId -> Maybe NgramsType
- unNgramsTypeId :: NgramsTypeId -> Int
- toNgramsTypeId :: Int -> NgramsTypeId
- withMap :: HashMap Text NgramsId -> Text -> NgramsId
- indexNgramsT :: HashMap Text NgramsId -> NgramsT Ngrams -> NgramsT (Indexed Int Ngrams)
- indexTypedNgrams :: HashMap Text NgramsId -> Typed NgramsType Ngrams -> Typed NgramsType (Indexed Int Ngrams)
- indexNgrams :: HashMap Text NgramsId -> Ngrams -> Indexed Int Ngrams
- indexNgramsWith :: (Text -> NgramsId) -> Ngrams -> Indexed Int Ngrams
Documentation
data NgramsPoly id terms n #
Ngrams table
n
is the size, see G.D.Q.T.Ngrams -> insertNgrams'
function. I.e. ngrams with 1 term are of size 1, ngrams with 2
terms are of size 2 etc.
NgramsDB | |
|
Instances
(ProductProfunctor p, Default p a1_0 a1_1, Default p a2_0 a2_1, Default p a3_0 a3_1) => Default p (NgramsPoly a1_0 a2_0 a3_0) (NgramsPoly a1_1 a2_1 a3_1) # | |
Defined in Gargantext.Database.Schema.Ngrams def :: p (NgramsPoly a1_0 a2_0 a3_0) (NgramsPoly a1_1 a2_1 a3_1) # | |
(Show id, Show terms, Show n) => Show (NgramsPoly id terms n) # | |
Defined in Gargantext.Database.Schema.Ngrams showsPrec :: Int -> NgramsPoly id terms n -> ShowS # show :: NgramsPoly id terms n -> String # showList :: [NgramsPoly id terms n] -> ShowS # |
type NgramsWrite = NgramsPoly (Maybe (Field SqlInt4)) (Field SqlText) (Field SqlInt4) #
type NgramsRead = NgramsPoly (Field SqlInt4) (Field SqlText) (Field SqlInt4) #
pNgramsDb :: forall p a1_0 a2_0 a3_0 a1_1 a2_1 a3_1. ProductProfunctor p => NgramsPoly (p a1_0 a1_1) (p a2_0 a2_1) (p a3_0 a3_1) -> p (NgramsPoly a1_0 a2_0 a3_0) (NgramsPoly a1_1 a2_1 a3_1) #
ngrams_terms :: forall id terms n terms. Lens (NgramsPoly id terms n) (NgramsPoly id terms n) terms terms #
ngrams_n :: forall id terms n n. Lens (NgramsPoly id terms n) (NgramsPoly id terms n) n n #
ngrams_id :: forall id terms n id. Lens (NgramsPoly id terms n) (NgramsPoly id terms n) id id #
text2ngrams :: Text -> Ngrams #
newtype NgramsTypeId #
Instances
pgNgramsType :: NgramsType -> Field SqlInt4 #
pgNgramsTypeId :: NgramsTypeId -> Field SqlInt4 #
ngramsTypeIds :: Bimap NgramsType NgramsTypeId #
Bidirectional map between an NgramsType
and its id.
NOTE This function is total in its domain by construction.
unNgramsTypeId :: NgramsTypeId -> Int #
toNgramsTypeId :: Int -> NgramsTypeId #
indexTypedNgrams :: HashMap Text NgramsId -> Typed NgramsType Ngrams -> Typed NgramsType (Indexed Int Ngrams) #
TODO replace NgramsT whith Typed NgramsType Ngrams
Orphan instances
HasDBid NgramsType # | |
toDBid :: NgramsType -> Int # lookupDBid :: Int -> Maybe NgramsType # | |
FromField Ngrams # | |
FromField NgramsType # | |
ToField NgramsType # | |
toField :: NgramsType -> Action # | |
ToRow Text # | |