Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext-prelude
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Przemyslaw Kaminski
haskell-gargantext-prelude
Commits
8f97fef4
Verified
Commit
8f97fef4
authored
Apr 14, 2023
by
Przemyslaw Kaminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[nlp] simplify types: we just map languages from ini config
parent
e250af8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
13 deletions
+5
-13
NLP.hs
src/Gargantext/Prelude/NLP.hs
+3
-9
Types.hs
src/Gargantext/Prelude/NLP/Types.hs
+2
-4
No files found.
src/Gargantext/Prelude/NLP.hs
View file @
8f97fef4
...
...
@@ -37,21 +37,15 @@ readConfig fp = do
ini
<-
readIniFile'
fp
let
val'
=
val
ini
iniSection
let
m_nlp_en
=
parseURI
$
cs
$
val'
"EN"
let
m_nlp_fr
=
parseURI
$
cs
$
val'
"FR"
let
m_nlp_all
=
parseURI
$
cs
$
val'
"All"
let
m_nlp_keys
=
filter
(
\
k
->
k
`
notElem
`
[
"
EN"
,
"FR"
,
"
All"
])
$
fromRight
[]
$
Ini
.
keys
iniSection
ini
let
m_nlp_keys
=
filter
(
\
k
->
k
`
notElem
`
[
"All"
])
$
fromRight
[]
$
Ini
.
keys
iniSection
ini
let
m_nlp_other
=
listToMaybeAll
$
(
\
k
->
(,)
k
<$>
(
parseURI
$
cs
$
val'
k
))
<$>
m_nlp_keys
let
mRet
=
NLPConfig
<$>
m_nlp_
en
<*>
m_nlp_fr
<*>
m_nlp_
all
<*>
(
Map
.
fromList
<$>
m_nlp_other
)
let
mRet
=
NLPConfig
<$>
m_nlp_all
<*>
(
Map
.
fromList
<$>
m_nlp_other
)
case
mRet
of
Nothing
->
panic
$
T
.
concat
[
"Cannot read config file: _nlp_en = "
,
T
.
pack
$
show
m_nlp_en
,
", _nlp_fr = "
,
T
.
pack
$
show
m_nlp_fr
,
", _nlp_all = "
Nothing
->
panic
$
T
.
concat
[
"Cannot read config file: _nlp_all = "
,
T
.
pack
$
show
m_nlp_all
,
", _nlp_other = "
,
T
.
pack
$
show
m_nlp_other
]
...
...
src/Gargantext/Prelude/NLP/Types.hs
View file @
8f97fef4
...
...
@@ -21,10 +21,8 @@ import Network.Socket (PortNumber)
import
Network.URI
(
URI
)
import
Protolude
data
NLPConfig
=
NLPConfig
{
_nlp_en
::
URI
,
_nlp_fr
::
URI
,
_nlp_all
::
URI
,
_nlp_other
::
(
Map
.
Map
T
.
Text
URI
)
}
data
NLPConfig
=
NLPConfig
{
_nlp_all
::
URI
,
_nlp_languages
::
(
Map
.
Map
T
.
Text
URI
)
}
deriving
(
Generic
,
Show
)
makeLenses
''
N
LPConfig
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