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 module Gargantext.Core
15 import Data.Text (Text)
17 import Data.Either(Either(Left))
18 import Data.Hashable (Hashable)
20 import GHC.Generics (Generic)
21 import Gargantext.Prelude
24 ------------------------------------------------------------------------
25 -- | Language of a Text
26 -- For simplicity, we suppose text has an homogenous language
28 -- Next steps: | DE | IT | SP
32 -- - DE == deutch (not implemented yet)
33 -- - IT == italian (not implemented yet)
34 -- - SP == spanish (not implemented yet)
36 -- ... add your language and help us to implement it (:
38 -- | All languages supported
39 -- TODO : DE | SP | CH
40 data Lang = EN | FR | All
41 deriving (Show, Eq, Ord, Bounded, Enum, Generic)
44 instance FromJSON Lang
45 instance ToSchema Lang
46 instance FromHttpApiData Lang
48 parseUrlPiece "EN" = pure EN
49 parseUrlPiece "FR" = pure FR
50 parseUrlPiece "All" = pure All
51 parseUrlPiece _ = Left "Unexpected value of OrderBy"
52 instance Hashable Lang
55 allLangs = [minBound ..]
61 instance HasDBid Lang where
69 fromDBid _ = panic "HasDBid lang, not implemented"
71 ------------------------------------------------------------------------
74 ------------------------------------------------------------------------
75 data PosTagAlgo = CoreNLP
76 deriving (Show, Read, Eq, Ord, Generic)
78 instance Hashable PosTagAlgo
80 instance HasDBid PosTagAlgo where
83 fromDBid _ = panic "HasDBid posTagAlgo : Not implemented"