1 {-# LANGUAGE DeriveAnyClass #-}
2 {-# LANGUAGE DuplicateRecordFields #-}
4 module Gargantext.API.GraphQL.NLP
12 import Control.Lens (view)
13 import qualified Data.Map.Strict as Map
14 import Data.Morpheus.Types
19 import Gargantext.API.Prelude (GargM, GargError)
20 import Gargantext.Core (Lang(..), NLPServerConfig(..), PosTagAlgo) -- , allLangs)
21 import Gargantext.Core.NLP (HasNLPServer(..))
22 import Gargantext.Prelude
27 { } deriving (Generic, GQLType)
29 type GqlM e env = Resolver QUERY e (GargM env GargError)
31 type LanguagesMap = Map.Map Lang NLPServer
33 data NLPServer = NLPServer
38 deriving (Show, Eq, Generic, GQLType)
41 :: HasNLPServer env => LanguagesArgs -> GqlM e env LanguagesMap
42 resolveLanguages LanguagesArgs { } = do
46 printDebug "[resolveLanguages] nlpServer" ns
47 pure $ Map.map (\(NLPServerConfig { .. }) -> NLPServer { server
48 , url = Protolude.show url }) ns