Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
haskell-gargantext
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
199
Issues
199
List
Board
Labels
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gargantext
haskell-gargantext
Commits
2c0ea8ca
Commit
2c0ea8ca
authored
May 16, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[DATE PARSER] fix lang export and internal use.
parent
16327c34
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
Date.hs
src/Gargantext/Text/Parsers/Date.hs
+8
-6
No files found.
src/Gargantext/Text/Parsers/Date.hs
View file @
2c0ea8ca
...
@@ -18,8 +18,9 @@ DGP.parseDate1 DGP.FR "12 avril 2010" == "2010-04-12T00:00:00.000+00:00"
...
@@ -18,8 +18,9 @@ DGP.parseDate1 DGP.FR "12 avril 2010" == "2010-04-12T00:00:00.000+00:00"
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
module
Gargantext.Text.Parsers.Date
(
parseDate1
,
Lang
(
FR
,
EN
),
parseDate
,
fromRFC3339
,
parseTimeOfDay
,
getMultiplicator
)
where
module
Gargantext.Text.Parsers.Date
(
parseDate1
,
parseDate
,
fromRFC3339
,
parseTimeOfDay
,
getMultiplicator
)
where
import
Gargantext.Core
(
Lang
(
FR
,
EN
))
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Prelude
(
toInteger
,
div
,
otherwise
,
(
++
))
import
Prelude
(
toInteger
,
div
,
otherwise
,
(
++
))
--import Gargantext.Types.Main as G
--import Gargantext.Types.Main as G
...
@@ -30,7 +31,8 @@ import Data.Time.LocalTime (utc)
...
@@ -30,7 +31,8 @@ import Data.Time.LocalTime (utc)
import
Duckling.Resolve
(
fromUTC
,
Context
(
Context
,
referenceTime
,
locale
)
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
,
Some
(
This
),
Dimension
(
Time
))
import
qualified
Duckling.Core
as
DC
import
Duckling.Types
(
jsonValue
,
Entity
)
import
Duckling.Types
(
jsonValue
,
Entity
)
import
Duckling.Api
(
analyze
,
parse
)
import
Duckling.Api
(
analyze
,
parse
)
...
@@ -63,9 +65,9 @@ import Text.XML.HXT.DOM.Util (decimalStringToInt)
...
@@ -63,9 +65,9 @@ import Text.XML.HXT.DOM.Util (decimalStringToInt)
-- TODO add Paris at Duckling.Locale Region datatype
-- TODO add Paris at Duckling.Locale Region datatype
-- | To get Homogeinity of the languages
-- | To get Homogeinity of the languages
-- TODO : put this in a more generic place in the source code
-- TODO : put this in a more generic place in the source code
--parserLang :: G.Language ->
Lang
parserLang
::
Lang
->
DC
.
Lang
--parserLang G.FR =
FR
parserLang
FR
=
DC
.
FR
--parserLang G.EN =
EN
parserLang
EN
=
DC
.
EN
-- | Final Date parser API
-- | Final Date parser API
...
@@ -93,7 +95,7 @@ utcToDucklingTime time = DucklingTime . zonedTimeToZoneSeriesTime $ fromUTC time
...
@@ -93,7 +95,7 @@ utcToDucklingTime time = DucklingTime . zonedTimeToZoneSeriesTime $ fromUTC time
-- | Local Context which depends on Lang and Time
-- | Local Context which depends on Lang and Time
localContext
::
Lang
->
DucklingTime
->
Context
localContext
::
Lang
->
DucklingTime
->
Context
localContext
lang
dt
=
Context
{
referenceTime
=
dt
,
locale
=
makeLocale
lang
Nothing
}
localContext
lang
dt
=
Context
{
referenceTime
=
dt
,
locale
=
makeLocale
(
parserLang
lang
)
Nothing
}
-- | Date parser with Duckling
-- | Date parser with Duckling
parseDateWithDuckling
::
Lang
->
Text
->
IO
[
ResolvedToken
]
parseDateWithDuckling
::
Lang
->
Text
->
IO
[
ResolvedToken
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment