Copyright | (c) CNRS 2017-Present |
---|---|
License | AGPL + CECILL v3 |
Maintainer | team@gargantext.org |
Stability | experimental |
Portability | POSIX |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Ngrams API
- - | TODO get ngrams filtered by NgramsType add get
Synopsis
- type TableNgramsApi = TableNgramsApiGet :<|> (TableNgramsApiPut :<|> (RecomputeScoresNgramsApiGet :<|> (("version" :> TableNgramsApiGetVersion) :<|> TableNgramsAsyncApi)))
- type TableNgramsApiGet = Summary " Table Ngrams API Get" :> (QueryParamR "ngramsType" TabType :> (QueryParamR "list" ListId :> (QueryParamR "limit" Limit :> (QueryParam "offset" Offset :> (QueryParam "listType" ListType :> (QueryParam "minTermSize" MinSize :> (QueryParam "maxTermSize" MaxSize :> (QueryParam "orderBy" OrderBy :> (QueryParam "search" Text :> Get '[JSON] (VersionedWithCount NgramsTable))))))))))
- type TableNgramsApiPut = Summary " Table Ngrams API Change" :> (QueryParamR "ngramsType" TabType :> (QueryParamR "list" ListId :> (ReqBody '[JSON] (Versioned NgramsTablePatch) :> Put '[JSON] (Versioned NgramsTablePatch))))
- commitStatePatch :: (HasNodeStory env err m, HasNodeStoryImmediateSaver env, HasNodeArchiveStoryImmediateSaver env) => ListId -> Versioned NgramsStatePatch' -> m (Versioned NgramsStatePatch')
- searchTableNgrams :: Versioned (Map NgramsTerm NgramsElement) -> NgramsSearchQuery -> VersionedWithCount NgramsTable
- getTableNgrams :: forall env err m. (HasNodeStory env err m, HasNodeError err) => NodeId -> ListId -> TabType -> NgramsSearchQuery -> m (VersionedWithCount NgramsTable)
- getTableNgramsCorpus :: (HasNodeStory env err m, HasNodeError err) => NodeId -> TabType -> ListId -> Limit -> Maybe Offset -> Maybe ListType -> Maybe MinSize -> Maybe MaxSize -> Maybe OrderBy -> Maybe Text -> m (VersionedWithCount NgramsTable)
- setListNgrams :: HasNodeStory env err m => NodeId -> NgramsType -> Map NgramsTerm NgramsRepoElement -> m ()
- apiNgramsTableCorpus :: NodeId -> ServerT TableNgramsApi (GargM Env BackendInternalError)
- apiNgramsTableDoc :: DocId -> ServerT TableNgramsApi (GargM Env BackendInternalError)
- data NgramsTablePatch
- type NgramsTableMap = Map NgramsTerm NgramsRepoElement
- newtype NgramsTerm = NgramsTerm {
- unNgramsTerm :: Text
- data NgramsElement = NgramsElement {}
- mkNgramsElement :: NgramsTerm -> ListType -> Maybe RootParent -> MSet NgramsTerm -> NgramsElement
- data RootParent = RootParent {}
- data MSet a
- mSetFromList :: Ord a => [a] -> MSet a
- mSetToList :: MSet a -> [a]
- data Repo s p = Repo {
- _r_version :: !Version
- _r_state :: !s
- _r_history :: ![p]
- r_version :: forall s p. Lens' (Repo s p) Version
- r_state :: forall s p s. Lens (Repo s p) (Repo s p) s s
- r_history :: forall s p p. Lens (Repo s p) (Repo s p) [p] [p]
- data NgramsRepoElement = NgramsRepoElement {
- _nre_size :: !Int
- _nre_list :: !ListType
- _nre_root :: !(Maybe NgramsTerm)
- _nre_parent :: !(Maybe NgramsTerm)
- _nre_children :: !(MSet NgramsTerm)
- saveNodeStory :: (MonadReader env m, MonadBase IO m, HasNodeStoryImmediateSaver env) => NodeId -> ArchiveList -> m ()
- initRepo :: Monoid s => Repo s p
- data TabType
- type QueryParamR = QueryParam' '[Required, Strict]
- data TODO
- getNgramsTableMap :: HasNodeStory env err m => NodeId -> NgramsType -> m (Versioned NgramsTableMap)
- dumpJsonTableMap :: HasNodeStory env err m => Text -> NodeId -> NgramsType -> m ()
- tableNgramsPull :: HasNodeStory env err m => ListId -> NgramsType -> Version -> m (Versioned NgramsTablePatch)
- tableNgramsPut :: (HasNodeStory env err m, HasNodeStoryImmediateSaver env, HasNodeArchiveStoryImmediateSaver env, HasValidationError err) => TabType -> ListId -> Versioned NgramsTablePatch -> m (Versioned NgramsTablePatch)
- getNgramsTable' :: forall env err m. (HasNodeStory env err m, HasNodeError err) => NodeId -> ListId -> NgramsType -> m (Versioned (Map NgramsTerm NgramsElement))
- setNgramsTableScores :: forall env err m t. (Each t t NgramsElement NgramsElement, HasNodeStory env err m, HasNodeError err) => NodeId -> ListId -> NgramsType -> t -> m t
- type Version = Int
- data Versioned a = Versioned {
- _v_version :: Version
- _v_data :: a
- data VersionedWithCount a = VersionedWithCount {
- _vc_version :: Version
- _vc_count :: Count
- _vc_data :: a
- currentVersion :: HasNodeStory env err m => ListId -> m Version
- listNgramsChangedSince :: HasNodeStory env err m => ListId -> NgramsType -> Version -> m (Versioned Bool)
- data MinSize
- data MaxSize
- data OrderBy
- data NgramsTable
- data UpdateTableNgramsCharts
Documentation
type TableNgramsApi = TableNgramsApiGet :<|> (TableNgramsApiPut :<|> (RecomputeScoresNgramsApiGet :<|> (("version" :> TableNgramsApiGetVersion) :<|> TableNgramsAsyncApi))) #
type TableNgramsApiGet = Summary " Table Ngrams API Get" :> (QueryParamR "ngramsType" TabType :> (QueryParamR "list" ListId :> (QueryParamR "limit" Limit :> (QueryParam "offset" Offset :> (QueryParam "listType" ListType :> (QueryParam "minTermSize" MinSize :> (QueryParam "maxTermSize" MaxSize :> (QueryParam "orderBy" OrderBy :> (QueryParam "search" Text :> Get '[JSON] (VersionedWithCount NgramsTable)))))))))) #
type TableNgramsApiPut = Summary " Table Ngrams API Change" :> (QueryParamR "ngramsType" TabType :> (QueryParamR "list" ListId :> (ReqBody '[JSON] (Versioned NgramsTablePatch) :> Put '[JSON] (Versioned NgramsTablePatch)))) #
commitStatePatch :: (HasNodeStory env err m, HasNodeStoryImmediateSaver env, HasNodeArchiveStoryImmediateSaver env) => ListId -> Versioned NgramsStatePatch' -> m (Versioned NgramsStatePatch') #
:: Versioned (Map NgramsTerm NgramsElement) | |
-> NgramsSearchQuery | The search query on the retrieved data |
-> VersionedWithCount NgramsTable |
TODO Errors management TODO: polymorphic for Annuaire or Corpus or ... | Table of Ngrams is a ListNgrams formatted (sorted and/or cut). TODO: should take only one ListId
pure function to query a 'Map NgramsTerm NgramsElement', according to a
search function. Returns a versioned NgramsTable
which is paginated and
sorted according to the input NgramsSearchQuery
, together with the
occurrences of the elements.
getTableNgrams :: forall env err m. (HasNodeStory env err m, HasNodeError err) => NodeId -> ListId -> TabType -> NgramsSearchQuery -> m (VersionedWithCount NgramsTable) #
getTableNgramsCorpus :: (HasNodeStory env err m, HasNodeError err) => NodeId -> TabType -> ListId -> Limit -> Maybe Offset -> Maybe ListType -> Maybe MinSize -> Maybe MaxSize -> Maybe OrderBy -> Maybe Text -> m (VersionedWithCount NgramsTable) #
setListNgrams :: HasNodeStory env err m => NodeId -> NgramsType -> Map NgramsTerm NgramsRepoElement -> m () #
TODO: incr the Version number && should use patch UNSAFE
data NgramsTablePatch #
Instances
newtype NgramsTerm #
Instances
data NgramsElement #
Instances
mkNgramsElement :: NgramsTerm -> ListType -> Maybe RootParent -> MSet NgramsTerm -> NgramsElement #
data RootParent #
Instances
Instances
mSetFromList :: Ord a => [a] -> MSet a #
mSetToList :: MSet a -> [a] #
TOREMOVE
Repo | |
|
Instances
(FromJSON s, FromJSON p) => FromJSON (Repo s p) # | |
(ToJSON s, ToJSON p) => ToJSON (Repo s p) # | |
Defined in Gargantext.API.Ngrams.Types | |
Generic (Repo s p) # | |
(Show s, Show p) => Show (Repo s p) # | |
(Serialise s, Serialise p) => Serialise (Repo s p) # | |
type Rep (Repo s p) # | |
Defined in Gargantext.API.Ngrams.Types type Rep (Repo s p) = D1 ('MetaData "Repo" "Gargantext.API.Ngrams.Types" "gargantext-0.0.7.1.5.3-inplace" 'False) (C1 ('MetaCons "Repo" 'PrefixI 'True) (S1 ('MetaSel ('Just "_r_version") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Version) :*: (S1 ('MetaSel ('Just "_r_state") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 s) :*: S1 ('MetaSel ('Just "_r_history") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [p])))) |
data NgramsRepoElement #
NgramsRepoElement | |
|
Instances
saveNodeStory :: (MonadReader env m, MonadBase IO m, HasNodeStoryImmediateSaver env) => NodeId -> ArchiveList -> m () #
Instances
type QueryParamR = QueryParam' '[Required, Strict] #
Instances
Generic TODO # | |
ToParamSchema TODO # | |
Defined in Gargantext.Core.Types toParamSchema :: forall (t :: SwaggerKind Type). Proxy TODO -> ParamSchema t # | |
ToSchema TODO # | |
Defined in Gargantext.Core.Types | |
type Rep TODO # | |
getNgramsTableMap :: HasNodeStory env err m => NodeId -> NgramsType -> m (Versioned NgramsTableMap) #
dumpJsonTableMap :: HasNodeStory env err m => Text -> NodeId -> NgramsType -> m () #
tableNgramsPull :: HasNodeStory env err m => ListId -> NgramsType -> Version -> m (Versioned NgramsTablePatch) #
tableNgramsPut :: (HasNodeStory env err m, HasNodeStoryImmediateSaver env, HasNodeArchiveStoryImmediateSaver env, HasValidationError err) => TabType -> ListId -> Versioned NgramsTablePatch -> m (Versioned NgramsTablePatch) #
getNgramsTable' :: forall env err m. (HasNodeStory env err m, HasNodeError err) => NodeId -> ListId -> NgramsType -> m (Versioned (Map NgramsTerm NgramsElement)) #
Helper function to get the ngrams table with scores.
setNgramsTableScores :: forall env err m t. (Each t t NgramsElement NgramsElement, HasNodeStory env err m, HasNodeError err) => NodeId -> ListId -> NgramsType -> t -> m t #
Helper function to set scores on an NgramsTable
.
Versioned | |
|
Instances
data VersionedWithCount a #
VersionedWithCount | |
|
Instances
currentVersion :: HasNodeStory env err m => ListId -> m Version #
listNgramsChangedSince :: HasNodeStory env err m => ListId -> NgramsType -> Version -> m (Versioned Bool) #
Instances
Num MinSize # | |
Show MinSize # | |
Eq MinSize # | |
FromHttpApiData MinSize # | |
Defined in Gargantext.Core.Types.Query parseUrlPiece :: Text -> Either Text MinSize # parseHeader :: ByteString -> Either Text MinSize # | |
ToHttpApiData MinSize # | |
Defined in Gargantext.Core.Types.Query toUrlPiece :: MinSize -> Text # toEncodedUrlPiece :: MinSize -> Builder # toHeader :: MinSize -> ByteString # toQueryParam :: MinSize -> Text # | |
ToParamSchema MinSize # | |
Defined in Gargantext.Core.Types.Query toParamSchema :: forall (t :: SwaggerKind Type). Proxy MinSize -> ParamSchema t # | |
ToSchema MinSize # | |
Defined in Gargantext.Core.Types.Query | |
HasSwagger (WithCustomErrorScheme GargAPI) # | |
Defined in Gargantext.API.Routes |
Instances
Num MaxSize # | |
Show MaxSize # | |
Eq MaxSize # | |
FromHttpApiData MaxSize # | |
Defined in Gargantext.Core.Types.Query parseUrlPiece :: Text -> Either Text MaxSize # parseHeader :: ByteString -> Either Text MaxSize # | |
ToHttpApiData MaxSize # | |
Defined in Gargantext.Core.Types.Query toUrlPiece :: MaxSize -> Text # toEncodedUrlPiece :: MaxSize -> Builder # toHeader :: MaxSize -> ByteString # toQueryParam :: MaxSize -> Text # | |
ToParamSchema MaxSize # | |
Defined in Gargantext.Core.Types.Query toParamSchema :: forall (t :: SwaggerKind Type). Proxy MaxSize -> ParamSchema t # | |
ToSchema MaxSize # | |
Defined in Gargantext.Core.Types.Query | |
HasSwagger (WithCustomErrorScheme GargAPI) # | |
Defined in Gargantext.API.Routes |
Instances
data NgramsTable #
Instances
data UpdateTableNgramsCharts #