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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
1f90ff74
Commit
1f90ff74
authored
Aug 21, 2018
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FACTO] textflow + cosmetics.
parent
d5093096
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
17 deletions
+25
-17
Main.hs
src/Gargantext/Core/Types/Main.hs
+1
-1
Node.hs
src/Gargantext/Database/Node.hs
+1
-1
Utils.hs
src/Gargantext/Database/Utils.hs
+1
-3
TextFlow.hs
src/Gargantext/TextFlow.hs
+22
-12
No files found.
src/Gargantext/Core/Types/Main.hs
View file @
1f90ff74
src/Gargantext/Database/Node.hs
View file @
1f90ff74
...
@@ -224,7 +224,7 @@ selectNodesWithType type_id = proc () -> do
...
@@ -224,7 +224,7 @@ selectNodesWithType type_id = proc () -> do
getNode
::
Connection
->
Int
->
IO
(
Node
Value
)
getNode
::
Connection
->
Int
->
IO
(
Node
Value
)
getNode
conn
id
=
do
getNode
conn
id
=
do
fromMaybe
(
error
$
"Node does node exist
e
: "
<>
show
id
)
.
headMay
<$>
runQuery
conn
(
limit
1
$
selectNode
(
pgInt4
id
))
fromMaybe
(
error
$
"Node does node exist: "
<>
show
id
)
.
headMay
<$>
runQuery
conn
(
limit
1
$
selectNode
(
pgInt4
id
))
getNodesWithType
::
Connection
->
Column
PGInt4
->
IO
[
Node
HyperdataDocument
]
getNodesWithType
::
Connection
->
Column
PGInt4
->
IO
[
Node
HyperdataDocument
]
...
...
src/Gargantext/Database/Utils.hs
View file @
1f90ff74
...
@@ -55,9 +55,7 @@ databaseParameters fp = do
...
@@ -55,9 +55,7 @@ databaseParameters fp = do
}
}
connectGargandb
::
FilePath
->
IO
Connection
connectGargandb
::
FilePath
->
IO
Connection
connectGargandb
fp
=
do
connectGargandb
fp
=
databaseParameters
fp
>>=
\
params
->
connect
params
parameters
<-
databaseParameters
fp
connect
parameters
printSql
::
Default
Unpackspec
a
a
=>
Query
a
->
IO
()
printSql
::
Default
Unpackspec
a
a
=>
Query
a
->
IO
()
printSql
=
putStrLn
.
maybe
"Empty query"
identity
.
showSqlForPostgres
printSql
=
putStrLn
.
maybe
"Empty query"
identity
.
showSqlForPostgres
...
...
src/Gargantext/TextFlow.hs
View file @
1f90ff74
...
@@ -27,7 +27,7 @@ import Data.Map.Strict (Map)
...
@@ -27,7 +27,7 @@ import Data.Map.Strict (Map)
import
qualified
Data.Array.Accelerate
as
A
import
qualified
Data.Array.Accelerate
as
A
import
qualified
Data.Map.Strict
as
M
import
qualified
Data.Map.Strict
as
M
----------------------------------------------
----------------------------------------------
import
Gargantext.Core
(
Lang
(
FR
)
)
import
Gargantext.Core
(
Lang
)
import
Gargantext.Core.Types
(
Label
)
import
Gargantext.Core.Types
(
Label
)
import
Gargantext.Prelude
import
Gargantext.Prelude
...
@@ -36,7 +36,7 @@ import Gargantext.Viz.Graph.Distances.Matrice (conditional)
...
@@ -36,7 +36,7 @@ import Gargantext.Viz.Graph.Distances.Matrice (conditional)
import
Gargantext.Viz.Graph
(
Graph
(
..
),
Node
(
..
),
Edge
(
..
),
Attributes
(
..
),
TypeNode
(
..
))
import
Gargantext.Viz.Graph
(
Graph
(
..
),
Node
(
..
),
Edge
(
..
),
Attributes
(
..
),
TypeNode
(
..
))
import
Gargantext.Text.Metrics.Count
(
cooc
)
import
Gargantext.Text.Metrics.Count
(
cooc
)
import
Gargantext.Text.Metrics
import
Gargantext.Text.Metrics
import
Gargantext.Text.Terms
(
TermType
(
Mono
)
,
extractTerms
)
import
Gargantext.Text.Terms
(
TermType
,
extractTerms
)
import
Gargantext.Text.Context
(
splitBy
,
SplitContext
(
Sentences
))
import
Gargantext.Text.Context
(
splitBy
,
SplitContext
(
Sentences
))
import
Gargantext.Text.Parsers.CSV
import
Gargantext.Text.Parsers.CSV
...
@@ -57,20 +57,31 @@ printDebug :: (Show a, MonadIO m) => [Char] -> a -> m ()
...
@@ -57,20 +57,31 @@ printDebug :: (Show a, MonadIO m) => [Char] -> a -> m ()
printDebug
msg
x
=
putStrLn
$
msg
<>
" "
<>
show
x
printDebug
msg
x
=
putStrLn
$
msg
<>
" "
<>
show
x
--printDebug _ _ = pure ()
--printDebug _ _ = pure ()
data
TextFlow
=
CSV
|
FullText
data
TextFlow
=
CSV
FilePath
|
FullText
FilePath
|
Contexts
[
T
.
Text
]
|
SQL
Int
|
Database
T
.
Text
-- | ExtDatabase Query
-- | IntDatabase NodeId
-- workflow :: Lang (EN|FR) -> FilePath -> Graph
textFlow
::
TermType
Lang
->
TextFlow
->
IO
Graph
textflow
::
Lang
->
TextFlow
->
FilePath
->
IO
Graph
textFlow
termType
workType
=
do
textflow
_
workType
path
=
do
-- Text <- IO Text <- FilePath
contexts
<-
case
workType
of
contexts
<-
case
workType
of
FullText
->
splitBy
(
Sentences
5
)
<$>
readFile
path
FullText
path
->
splitBy
(
Sentences
5
)
<$>
readFile
path
CSV
->
readCsvOn
[
csv_title
,
csv_abstract
]
path
CSV
path
->
readCsvOn
[
csv_title
,
csv_abstract
]
path
Contexts
ctxt
->
pure
ctxt
_
->
undefined
textFlow'
termType
contexts
textFlow'
::
TermType
Lang
->
[
T
.
Text
]
->
IO
Graph
textFlow'
termType
contexts
=
do
-- Context :: Text -> [Text]
-- Context :: Text -> [Text]
-- Contexts = Paragraphs n | Sentences n | Chars n
-- Contexts = Paragraphs n | Sentences n | Chars n
myterms
<-
extractTerms
(
Mono
FR
)
contexts
myterms
<-
extractTerms
termType
contexts
-- TermsType = Mono | Multi | MonoMulti
-- TermsType = Mono | Multi | MonoMulti
-- myterms # filter (\t -> not . elem t stopList)
-- myterms # filter (\t -> not . elem t stopList)
-- # groupBy (Stem|GroupList|Ontology)
-- # groupBy (Stem|GroupList|Ontology)
...
@@ -122,7 +133,6 @@ textflow _ workType path = do
...
@@ -122,7 +133,6 @@ textflow _ workType path = do
--printDebug "partitions" partitions
--printDebug "partitions" partitions
pure
$
data2graph
(
M
.
toList
ti
)
myCooc4
distanceMap
partitions
pure
$
data2graph
(
M
.
toList
ti
)
myCooc4
distanceMap
partitions
-----------------------------------------------------------
-----------------------------------------------------------
-- distance should not be a map since we just "toList" it (same as cLouvain)
-- distance should not be a map since we just "toList" it (same as cLouvain)
data2graph
::
[(
Label
,
Int
)]
->
Map
(
Int
,
Int
)
Int
data2graph
::
[(
Label
,
Int
)]
->
Map
(
Int
,
Int
)
Int
...
...
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