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
195
Issues
195
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
88befdc7
Commit
88befdc7
authored
Jun 20, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TERMS] clean/refacto before integration to workflow.
parent
5e68e57c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
10 deletions
+13
-10
Flow.hs
src/Gargantext/Database/Flow.hs
+1
-0
Terms.hs
src/Gargantext/Text/Terms.hs
+2
-2
Eleve.hs
src/Gargantext/Text/Terms/Eleve.hs
+2
-2
API.hs
src/Gargantext/Viz/Graph/API.hs
+1
-1
Tools.hs
src/Gargantext/Viz/Graph/Tools.hs
+7
-5
No files found.
src/Gargantext/Database/Flow.hs
View file @
88befdc7
...
@@ -186,6 +186,7 @@ insertMasterDocs c lang hs = do
...
@@ -186,6 +186,7 @@ insertMasterDocs c lang hs = do
ids
<-
insertDb
masterUserId
masterCorpusId
hs'
ids
<-
insertDb
masterUserId
masterCorpusId
hs'
let
documentsWithId
=
mergeData
(
toInserted
ids
)
(
Map
.
fromList
$
map
viewUniqId'
hs'
)
let
documentsWithId
=
mergeData
(
toInserted
ids
)
(
Map
.
fromList
$
map
viewUniqId'
hs'
)
-- maps :: IO Map Ngrams (Map NgramsType (Map NodeId Int))
maps
<-
mapNodeIdNgrams
<$>
documentIdWithNgrams
(
extractNgramsT
lang
)
documentsWithId
maps
<-
mapNodeIdNgrams
<$>
documentIdWithNgrams
(
extractNgramsT
lang
)
documentsWithId
terms2id
<-
insertNgrams
$
Map
.
keys
maps
terms2id
<-
insertNgrams
$
Map
.
keys
maps
let
indexedNgrams
=
Map
.
mapKeys
(
indexNgrams
terms2id
)
maps
let
indexedNgrams
=
Map
.
mapKeys
(
indexNgrams
terms2id
)
maps
...
...
src/Gargantext/Text/Terms.hs
View file @
88befdc7
...
@@ -49,7 +49,7 @@ import qualified Data.List as List
...
@@ -49,7 +49,7 @@ import qualified Data.List as List
import
qualified
Data.Text
as
Text
import
qualified
Data.Text
as
Text
import
Gargantext.Text
(
sentences
)
import
Gargantext.Text
(
sentences
)
import
Gargantext.Text.Terms.Mono.Token.En
(
tokenize
)
import
Gargantext.Text.Terms.Mono.Token.En
(
tokenize
)
import
Gargantext.Text.Eleve
(
mainEleve
)
import
Gargantext.Text.
Terms.
Eleve
(
mainEleve
)
data
TermType
lang
data
TermType
lang
=
Mono
{
_tt_lang
::
lang
}
=
Mono
{
_tt_lang
::
lang
}
...
@@ -88,7 +88,7 @@ isPunctuation x = List.elem x $ (Text.pack . pure)
...
@@ -88,7 +88,7 @@ isPunctuation x = List.elem x $ (Text.pack . pure)
-- | Unsupervised ngrams extraction
-- | Unsupervised ngrams extraction
-- language agnostic extraction
-- language agnostic extraction
-- TODO: remove IO
-- TODO: remove IO
-- TODO:
BlockText
-- TODO:
newtype BlockText
extractTermsUnsupervised
::
Int
->
Text
->
[[
Text
]]
extractTermsUnsupervised
::
Int
->
Text
->
[[
Text
]]
extractTermsUnsupervised
n
=
extractTermsUnsupervised
n
=
List
.
nub
List
.
nub
...
...
src/Gargantext/Text/Eleve.hs
→
src/Gargantext/Text/
Terms/
Eleve.hs
View file @
88befdc7
{-|
{-|
Module : Gargantext.Text.Eleve
Module : Gargantext.Text.
Terms.
Eleve
Description : Unsupervized Word segmentation
Description : Unsupervized Word segmentation
Copyright : (c) CNRS, 2019-Present
Copyright : (c) CNRS, 2019-Present
License : AGPL + CECILL v3
License : AGPL + CECILL v3
...
@@ -38,7 +38,7 @@ Notes for current implementation:
...
@@ -38,7 +38,7 @@ Notes for current implementation:
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE TypeFamilies #-}
module
Gargantext.Text.Eleve
where
module
Gargantext.Text.
Terms.
Eleve
where
-- import Debug.Trace (trace)
-- import Debug.Trace (trace)
-- import Debug.SimpleReflect
-- import Debug.SimpleReflect
...
...
src/Gargantext/Viz/Graph/API.hs
View file @
88befdc7
...
@@ -75,7 +75,7 @@ getGraph nId = do
...
@@ -75,7 +75,7 @@ getGraph nId = do
<$>
groupNodesByNgrams
ngs
<$>
groupNodesByNgrams
ngs
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
NgramsTerms
(
Map
.
keys
ngs
)
<$>
getNodesByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
NgramsTerms
(
Map
.
keys
ngs
)
graph
<-
liftIO
$
cooc2graph
myCooc
graph
<-
liftIO
$
cooc2graph
3
myCooc
pure
$
set
graph_metadata
(
Just
metadata
)
graph
pure
$
set
graph_metadata
(
Just
metadata
)
graph
...
...
src/Gargantext/Viz/Graph/Tools.hs
View file @
88befdc7
...
@@ -35,11 +35,13 @@ import qualified Data.Vector.Storable as Vec
...
@@ -35,11 +35,13 @@ import qualified Data.Vector.Storable as Vec
import
qualified
Data.Map
as
Map
import
qualified
Data.Map
as
Map
import
qualified
Data.List
as
List
import
qualified
Data.List
as
List
cooc2graph
::
(
Map
(
Text
,
Text
)
Int
)
->
IO
Graph
type
Threshold
=
Int
cooc2graph
myCooc
=
do
cooc2graph
::
Threshold
->
(
Map
(
Text
,
Text
)
Int
)
->
IO
Graph
cooc2graph
threshold
myCooc
=
do
let
(
ti
,
_
)
=
createIndices
myCooc
let
(
ti
,
_
)
=
createIndices
myCooc
myCooc
4
=
toIndex
ti
myCooc
myCooc
'
=
toIndex
ti
myCooc
matCooc
=
map2mat
(
0
)
(
Map
.
size
ti
)
myCooc4
matCooc
=
map2mat
(
0
)
(
Map
.
size
ti
)
$
Map
.
filter
(
>
threshold
)
myCooc'
distanceMat
=
measureConditional
matCooc
distanceMat
=
measureConditional
matCooc
distanceMap
=
Map
.
filter
(
>
0.01
)
$
mat2map
distanceMat
distanceMap
=
Map
.
filter
(
>
0.01
)
$
mat2map
distanceMat
...
@@ -50,7 +52,7 @@ cooc2graph myCooc = do
...
@@ -50,7 +52,7 @@ cooc2graph myCooc = do
let
bridgeness'
=
bridgeness
300
partitions
distanceMap
let
bridgeness'
=
bridgeness
300
partitions
distanceMap
let
confluence'
=
confluence
(
Map
.
keys
bridgeness'
)
3
True
False
let
confluence'
=
confluence
(
Map
.
keys
bridgeness'
)
3
True
False
data2graph
(
Map
.
toList
ti
)
myCooc
4
bridgeness'
confluence'
partitions
data2graph
(
Map
.
toList
ti
)
myCooc
'
bridgeness'
confluence'
partitions
----------------------------------------------------------
----------------------------------------------------------
...
...
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