Commit 1b523c37 authored by Alexandre Delanoë's avatar Alexandre Delanoë

[FIX] hard path in dependencies.

parent 540456ba
...@@ -92,6 +92,7 @@ library: ...@@ -92,6 +92,7 @@ library:
- split - split
- tagsoup - tagsoup
- text-metrics - text-metrics
# - utc
- time - time
- timezone-series - timezone-series
- time-locale-compat - time-locale-compat
......
...@@ -16,7 +16,7 @@ DGP.parseDate1 DGP.FR "12 avril 2010" == "2010-04-12T00:00:00.000+00:00" ...@@ -16,7 +16,7 @@ DGP.parseDate1 DGP.FR "12 avril 2010" == "2010-04-12T00:00:00.000+00:00"
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Data.Gargantext.Parsers.Date (parseDate1, Lang(FR, EN)) where module Data.Gargantext.Parsers.Date (parseDate1, Lang(FR, EN), parseDate) where
import Data.Gargantext.Prelude import Data.Gargantext.Prelude
--import Data.Gargantext.Types.Main as G --import Data.Gargantext.Types.Main as G
...@@ -28,10 +28,9 @@ import Duckling.Resolve (fromUTC, Context(Context, referenceTime, locale) ...@@ -28,10 +28,9 @@ import Duckling.Resolve (fromUTC, Context(Context, referenceTime, locale)
, DucklingTime(DucklingTime) , DucklingTime(DucklingTime)
) )
import Duckling.Core (makeLocale, Lang(FR,EN), Some(This), Dimension(Time)) import Duckling.Core (makeLocale, Lang(FR,EN), Some(This), Dimension(Time))
import Duckling.Types (jsonValue) import Duckling.Types (jsonValue, Entity)
--import qualified Duckling.Core as DC
import Duckling.Api (analyze) import Duckling.Api (analyze, parse)
import qualified Data.HashSet as HashSet import qualified Data.HashSet as HashSet
import qualified Data.Aeson as Json import qualified Data.Aeson as Json
import Data.HashMap.Strict as HM import Data.HashMap.Strict as HM
...@@ -78,7 +77,17 @@ localContext lang dt = Context {referenceTime = dt, locale = makeLocale lang Not ...@@ -78,7 +77,17 @@ localContext lang dt = Context {referenceTime = dt, locale = makeLocale lang Not
-- | Date parser with Duckling -- | Date parser with Duckling
parseDateWithDuckling :: Lang -> Text -> IO [ResolvedToken] parseDateWithDuckling :: Lang -> Text -> IO [ResolvedToken]
parseDateWithDuckling lang input = do parseDateWithDuckling lang input = do
ctx <- localContext lang <$> utcToDucklingTime <$> getCurrentTime contxt <- localContext lang <$> utcToDucklingTime <$> getCurrentTime
--pure $ parseAndResolve (rulesFor (locale ctx) (HashSet.fromList [(This Time)])) input ctx --pure $ parseAndResolve (rulesFor (locale ctx) (HashSet.fromList [(This Time)])) input ctx
pure $ analyze input ctx $ HashSet.fromList [(This Time)] pure $ analyze input contxt $ HashSet.fromList [(This Time)]
parseDate :: Lang -> Text -> IO [Entity]
parseDate lang input = do
context <- localContext lang <$> utcToDucklingTime <$> getCurrentTime
pure $ parse input context [(This Time)]
...@@ -2,11 +2,11 @@ flags: {} ...@@ -2,11 +2,11 @@ flags: {}
extra-package-dbs: [] extra-package-dbs: []
packages: packages:
- . - .
- /home/alexandre/local/logiciels/haskell/servant/servant-multipart #- /home/alexandre/local/logiciels/haskell/servant/servant-multipart
#- /home/alexandre/local/logiciels/haskell/utc
extra-deps: extra-deps:
- aeson-1.0.2.1 - aeson-1.0.2.1
- duckling-0.1.3.0 - duckling-0.1.3.0
- protolude-0.2 - protolude-0.2
- generic-lens-0.4.0.1 - servant-multipart-0.10.0.1
- GenericPretty-1.2.1
resolver: lts-9.2 resolver: lts-9.2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment