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
157
Issues
157
List
Board
Labels
Milestones
Merge Requests
9
Merge Requests
9
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
Show 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
ids
<-
insertDb
masterUserId
masterCorpusId
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
terms2id
<-
insertNgrams
$
Map
.
keys
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
import
qualified
Data.Text
as
Text
import
Gargantext.Text
(
sentences
)
import
Gargantext.Text.Terms.Mono.Token.En
(
tokenize
)
import
Gargantext.Text.Eleve
(
mainEleve
)
import
Gargantext.Text.
Terms.
Eleve
(
mainEleve
)
data
TermType
lang
=
Mono
{
_tt_lang
::
lang
}
...
...
@@ -88,7 +88,7 @@ isPunctuation x = List.elem x $ (Text.pack . pure)
-- | Unsupervised ngrams extraction
-- language agnostic extraction
-- TODO: remove IO
-- TODO:
BlockText
-- TODO:
newtype BlockText
extractTermsUnsupervised
::
Int
->
Text
->
[[
Text
]]
extractTermsUnsupervised
n
=
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
Copyright : (c) CNRS, 2019-Present
License : AGPL + CECILL v3
...
...
@@ -38,7 +38,7 @@ Notes for current implementation:
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module
Gargantext.Text.Eleve
where
module
Gargantext.Text.
Terms.
Eleve
where
-- import Debug.Trace (trace)
-- import Debug.SimpleReflect
...
...
src/Gargantext/Viz/Graph/API.hs
View file @
88befdc7
...
...
@@ -75,7 +75,7 @@ getGraph nId = do
<$>
groupNodesByNgrams
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
...
...
src/Gargantext/Viz/Graph/Tools.hs
View file @
88befdc7
...
...
@@ -35,11 +35,13 @@ import qualified Data.Vector.Storable as Vec
import
qualified
Data.Map
as
Map
import
qualified
Data.List
as
List
cooc2graph
::
(
Map
(
Text
,
Text
)
Int
)
->
IO
Graph
cooc2graph
myCooc
=
do
type
Threshold
=
Int
cooc2graph
::
Threshold
->
(
Map
(
Text
,
Text
)
Int
)
->
IO
Graph
cooc2graph
threshold
myCooc
=
do
let
(
ti
,
_
)
=
createIndices
myCooc
myCooc
4
=
toIndex
ti
myCooc
matCooc
=
map2mat
(
0
)
(
Map
.
size
ti
)
myCooc4
myCooc
'
=
toIndex
ti
myCooc
matCooc
=
map2mat
(
0
)
(
Map
.
size
ti
)
$
Map
.
filter
(
>
threshold
)
myCooc'
distanceMat
=
measureConditional
matCooc
distanceMap
=
Map
.
filter
(
>
0.01
)
$
mat2map
distanceMat
...
...
@@ -50,7 +52,7 @@ cooc2graph myCooc = do
let
bridgeness'
=
bridgeness
300
partitions
distanceMap
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