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
1
Issues
1
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
gargantext
haskell-gargantext-prelude
Commits
035036f4
Commit
035036f4
authored
Jan 15, 2024
by
Fabien Manière
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make All optional: put EN instead.
parent
5a8dc3a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
NLP.hs
src/Gargantext/Prelude/NLP.hs
+8
-4
No files found.
src/Gargantext/Prelude/NLP.hs
View file @
035036f4
...
@@ -31,17 +31,21 @@ readConfig :: FilePath -> IO NLPConfig
...
@@ -31,17 +31,21 @@ readConfig :: FilePath -> IO NLPConfig
readConfig
fp
=
do
readConfig
fp
=
do
ini
<-
readIniFile'
fp
ini
<-
readIniFile'
fp
let
val'
=
val
ini
iniSection
let
val'
=
val
ini
iniSection
let
lang_default_text
=
"EN"
-- Change this value by one of your choice: "All" or "FR", "EN"
let
m_nlp_all
=
parseURI
$
cs
$
val'
"All"
-- let m_nlp_all = parseURI $ cs $ val'
let
m_nlp_default
=
parseURI
$
cs
$
val'
lang_default_text
let
m_nlp_keys
=
filter
(
\
k
->
k
`
notElem
`
[
"All"
])
$
fromRight
[]
$
Ini
.
keys
iniSection
ini
let
m_nlp_keys
=
filter
(
\
k
->
k
`
notElem
`
[
lang_default_text
])
$
fromRight
[]
$
Ini
.
keys
iniSection
ini
let
m_nlp_other
=
listToMaybeAll
$
(
\
k
->
(,)
k
<$>
(
parseURI
$
cs
$
val'
k
))
<$>
m_nlp_keys
let
m_nlp_other
=
listToMaybeAll
$
(
\
k
->
(,)
k
<$>
(
parseURI
$
cs
$
val'
k
))
<$>
m_nlp_keys
let
mRet
=
NLPConfig
<$>
m_nlp_all
<*>
(
Map
.
fromList
<$>
m_nlp_other
)
-- let mRet = NLPConfig <$> m_nlp_all <*> (Map.fromList <$> m_nlp_other)
let
mRet
=
NLPConfig
<$>
m_nlp_default
<*>
(
Map
.
fromList
<$>
m_nlp_other
)
case
mRet
of
case
mRet
of
Nothing
->
panicTrace
$
T
.
concat
[
"Cannot read config file: _nlp_all = "
Nothing
->
panicTrace
$
T
.
concat
[
"Cannot read config file: _nlp_all = "
,
T
.
pack
$
show
m_nlp_all
-- , T.pack $ show m_nlp_all
,
T
.
pack
$
show
m_nlp_default
,
", _nlp_other = "
,
", _nlp_other = "
,
T
.
pack
$
show
m_nlp_other
]
,
T
.
pack
$
show
m_nlp_other
]
Just
ret
->
pure
ret
Just
ret
->
pure
ret
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