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
18 import Data.Either(Either(Left))
19 import Data.Hashable (Hashable)
20 import Data.Morpheus.Types (GQLType)
22 import Data.Text (Text)
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 Hashable Lang
58 allLangs = [minBound ..]
64 instance HasDBid Lang where
72 fromDBid _ = panic "HasDBid lang, not implemented"
74 ------------------------------------------------------------------------
77 ------------------------------------------------------------------------
78 data PosTagAlgo = CoreNLP
79 deriving (Show, Read, Eq, Ord, Generic)
81 instance Hashable PosTagAlgo
83 instance HasDBid PosTagAlgo where
86 fromDBid _ = panic "HasDBid posTagAlgo : Not implemented"