2 Module : Gargantext.Core
3 Description : Supported Natural language
4 Copyright : (c) CNRS, 2017-Present
5 License : AGPL + CECILL v3
6 Maintainer : team@gargantext.org
7 Stability : experimental
12 {-# LANGUAGE DeriveAnyClass #-}
14 module Gargantext.Core
17 import Data.Text (Text, pack)
19 import Data.Either(Either(Left))
20 import Data.Hashable (Hashable)
21 import Data.Morpheus.Types (GQLType)
23 import GHC.Generics (Generic)
24 import Gargantext.Prelude
27 ------------------------------------------------------------------------
28 -- | Language of a Text
29 -- For simplicity, we suppose text has an homogenous language
31 -- Next steps: | DE | IT | SP
35 -- - DE == deutch (not implemented yet)
36 -- - IT == italian (not implemented yet)
37 -- - SP == spanish (not implemented yet)
39 -- ... add your language and help us to implement it (:
41 -- | All languages supported
42 -- TODO : DE | SP | CH
43 data Lang = EN | FR | All
44 deriving (Show, Eq, Ord, Bounded, Enum, Generic, GQLType)
47 instance FromJSON Lang
48 instance ToSchema Lang
49 instance FromHttpApiData Lang
51 parseUrlPiece "EN" = pure EN
52 parseUrlPiece "FR" = pure FR
53 parseUrlPiece "All" = pure All
54 parseUrlPiece _ = Left "Unexpected value of OrderBy"
55 instance ToHttpApiData Lang where
56 toUrlPiece = pack . show
57 instance Hashable Lang
60 allLangs = [minBound ..]
66 instance HasDBid Lang where
74 fromDBid _ = panic "HasDBid lang, not implemented"
76 ------------------------------------------------------------------------
79 ------------------------------------------------------------------------
80 data PosTagAlgo = CoreNLP | JohnSnowServer
81 deriving (Show, Read, Eq, Ord, Generic)
83 instance Hashable PosTagAlgo
85 instance HasDBid PosTagAlgo where
88 fromDBid 2 = JohnSnowServer
89 fromDBid _ = panic "HasDBid posTagAlgo : Not implemented"