Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
haskell-gargantext
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
Commits
5a8e884b
Commit
5a8e884b
authored
Sep 16, 2019
by
qlobbe
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dev-phylo
parents
071c8ddf
365c0e0d
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
14 deletions
+90
-14
README.md
README.md
+4
-4
Main.hs
bin/gargantext-init/Main.hs
+54
-0
package.yaml
package.yaml
+14
-0
Flow.hs
src/Gargantext/Database/Flow.hs
+10
-4
List.hs
src/Gargantext/Text/List.hs
+6
-4
stack.yaml
stack.yaml
+2
-2
No files found.
README.md
View file @
5a8e884b
...
...
@@ -39,17 +39,17 @@ issues.
### Initialization
Users has to be created first
1.
stack ghci
2.
runCmd insertUsersDemo
Users has to be created first (user1 is created as instance):
Then you can log in with user1:1resu
-
stack install
-
~/.local/bin/gargantext-init "gargantext.ini"
## Use Cases
### Multi-User with Graphical User Interface (Server Mode)
~/.local/bin/stack --docker exec gargantext-server -- --ini "gargantext.ini" --run Prod
Then you can log in with user1:1resu
### Command Line Mode tools
...
...
bin/gargantext-init/Main.hs
0 → 100644
View file @
5a8e884b
{-|
Module : Main.hs
Description : Gargantext Import Corpus
Copyright : (c) CNRS, 2017-Present
License : AGPL + CECILL v3
Maintainer : team@gargantext.org
Stability : experimental
Portability : POSIX
Import a corpus binary.
-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Strict #-}
module
Main
where
import
System.Environment
(
getArgs
)
import
Gargantext.Prelude
import
Gargantext.Database.Flow
(
FlowCmdM
,
flowCorpusFile
,
getOrMkRoot
)
import
Gargantext.Text.Corpus.Parsers
(
FileFormat
(
..
))
import
Gargantext.Database.Utils
(
Cmd
,
)
import
Gargantext.Database.Types.Node
(
CorpusId
,
toHyperdataDocument
,
RootId
)
import
Gargantext.Database.Schema.User
(
insertUsersDemo
,
UserId
)
import
Gargantext.Text.Terms
(
TermType
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.API
-- (GargError)
import
Gargantext.API.Node
()
-- instances
import
Gargantext.API.Settings
(
withDevEnv
,
runCmdDev
,
DevEnv
)
--import Gargantext.Text.Corpus.Parsers.GrandDebat (readFile, GrandDebatReference(..))
import
Data.Text
(
Text
)
import
qualified
Data.Text
as
Text
import
Control.Monad.IO.Class
(
liftIO
)
main
::
IO
()
main
=
do
[
iniPath
]
<-
getArgs
let
createUsers
::
Cmd
GargError
Int64
createUsers
=
insertUsersDemo
let
mkRoots
::
Cmd
GargError
(
UserId
,
RootId
)
mkRoots
=
getOrMkRoot
"user1"
withDevEnv
iniPath
$
\
env
->
do
_
<-
runCmdDev
env
createUsers
_
<-
runCmdDev
env
mkRoots
pure
()
package.yaml
View file @
5a8e884b
...
...
@@ -321,6 +321,20 @@ executables:
-
base
-
servant-server
gargantext-init
:
main
:
Main.hs
source-dirs
:
bin/gargantext-init
ghc-options
:
-
-threaded
-
-rtsopts
-
-with-rtsopts=-N
-
-O2
-
-Wmissing-signatures
dependencies
:
-
gargantext
-
base
tests
:
# garg-test:
# main: Main.hs
...
...
src/Gargantext/Database/Flow.hs
View file @
5a8e884b
...
...
@@ -246,10 +246,9 @@ insertMasterDocs c lang hs = do
type
CorpusName
=
Text
getOrMkRootWithCorpus
::
(
HasNodeError
err
,
MkCorpus
a
)
=>
Username
->
Either
CorpusName
[
CorpusId
]
->
Maybe
a
->
Cmd
err
(
UserId
,
RootId
,
CorpusId
)
getOrMkRootWithCorpus
username
cName
c
=
do
getOrMkRoot
::
(
HasNodeError
err
)
=>
Username
->
Cmd
err
(
UserId
,
RootId
)
getOrMkRoot
username
=
do
maybeUserId
<-
getUser
username
userId
<-
case
maybeUserId
of
Nothing
->
nodeError
NoUserFound
...
...
@@ -264,7 +263,14 @@ getOrMkRootWithCorpus username cName c = do
False
->
pure
rootId'
rootId
<-
maybe
(
nodeError
NoRootFound
)
pure
(
head
rootId''
)
pure
(
userId
,
rootId
)
getOrMkRootWithCorpus
::
(
HasNodeError
err
,
MkCorpus
a
)
=>
Username
->
Either
CorpusName
[
CorpusId
]
->
Maybe
a
->
Cmd
err
(
UserId
,
RootId
,
CorpusId
)
getOrMkRootWithCorpus
username
cName
c
=
do
(
userId
,
rootId
)
<-
getOrMkRoot
username
corpusId''
<-
if
username
==
userMaster
then
do
ns
<-
getCorporaWithParentId
rootId
...
...
src/Gargantext/Text/List.hs
View file @
5a8e884b
...
...
@@ -61,7 +61,6 @@ buildNgramsLists :: Lang -> Int -> Int -> StopSize -> UserCorpusId -> MasterCorp
->
Cmd
err
(
Map
NgramsType
[
NgramsElement
])
buildNgramsLists
l
n
m
s
uCid
mCid
=
do
ngTerms
<-
buildNgramsTermsList
l
n
m
s
uCid
mCid
--ngTerms <- buildNgramsTermsList' uCid (ngramsGroup l n m) (isStopTerm s . fst) 500 50
othersTerms
<-
mapM
(
buildNgramsOthersList
uCid
identity
)
[
Authors
,
Sources
,
Institutes
]
pure
$
Map
.
unions
$
othersTerms
<>
[
ngTerms
]
...
...
@@ -72,9 +71,12 @@ buildNgramsOthersList uCid groupIt nt = do
ngs
<-
groupNodesByNgramsWith
groupIt
<$>
getNodesByNgramsUser
uCid
nt
let
all'
=
Map
.
toList
ngs
pure
$
(
toElements
GraphTerm
all'
)
<>
(
toElements
CandidateTerm
all'
)
--pure $ (toElements GraphTerm $ take 10 all') <> (toElements CandidateTerm $ drop 10 all')
listSize
=
9
all'
=
List
.
reverse
$
List
.
sortOn
(
Set
.
size
.
snd
.
snd
)
$
Map
.
toList
ngs
graphTerms
=
List
.
take
listSize
all'
candiTerms
=
List
.
drop
listSize
all'
pure
$
Map
.
unionsWith
(
<>
)
[
toElements
GraphTerm
graphTerms
,
toElements
CandidateTerm
candiTerms
]
where
toElements
nType
x
=
Map
.
fromList
[(
nt
,
[
mkNgramsElement
t
nType
Nothing
(
mSetFromList
[]
)
|
(
t
,
_ns
)
<-
x
...
...
stack.yaml
View file @
5a8e884b
resolver
:
lts-14.
1
resolver
:
lts-14.
6
flags
:
{}
extra-package-dbs
:
[]
packages
:
...
...
@@ -15,7 +15,7 @@ extra-deps:
-
git
:
https://gitlab.iscpif.fr/gargantext/hlcm.git
commit
:
6f0595d2421005837d59151a8b26eee83ebb67b5
-
git
:
https://github.com/delanoe/servant-static-th.git
commit
:
ba5347e7d8a13ce5275af8470c15b2305fbb23af
commit
:
7d0e4dcd2cfe97f2843a70a0de10df32c309bcd1
-
git
:
https://github.com/delanoe/hstatistics.git
commit
:
90eef7604bb230644c2246eccd094d7bfefcb135
-
git
:
https://github.com/paulrzcz/HSvm.git
...
...
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