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
7d5b1cfc
Commit
7d5b1cfc
authored
Jul 30, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[CLEAN] Metrics
parent
e054bffe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
11 deletions
+15
-11
NgramsByNode.hs
src/Gargantext/Database/Action/Metrics/NgramsByNode.hs
+0
-8
List.hs
src/Gargantext/Text/List.hs
+2
-2
TFICF.hs
src/Gargantext/Text/Metrics/TFICF.hs
+13
-1
No files found.
src/Gargantext/Database/Action/Metrics/NgramsByNode.hs
View file @
7d5b1cfc
...
@@ -19,14 +19,12 @@ module Gargantext.Database.Action.Metrics.NgramsByNode
...
@@ -19,14 +19,12 @@ module Gargantext.Database.Action.Metrics.NgramsByNode
import
Data.Map.Strict
(
Map
,
fromListWith
,
elems
,
toList
,
fromList
)
import
Data.Map.Strict
(
Map
,
fromListWith
,
elems
,
toList
,
fromList
)
import
Data.Map.Strict.Patch
(
PatchMap
,
Replace
,
diff
)
import
Data.Map.Strict.Patch
(
PatchMap
,
Replace
,
diff
)
import
Data.Set
(
Set
)
import
Data.Set
(
Set
)
import
qualified
Data.Ord
as
DO
(
Down
(
..
))
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Data.Tuple.Extra
(
second
,
swap
)
import
Data.Tuple.Extra
(
second
,
swap
)
import
Database.PostgreSQL.Simple.SqlQQ
(
sql
)
import
Database.PostgreSQL.Simple.SqlQQ
(
sql
)
import
Database.PostgreSQL.Simple.Types
(
Values
(
..
),
QualifiedIdentifier
(
..
))
import
Database.PostgreSQL.Simple.Types
(
Values
(
..
),
QualifiedIdentifier
(
..
))
import
Debug.Trace
(
trace
)
import
Debug.Trace
(
trace
)
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Types
(
Ordering
(
..
))
import
Gargantext.Database.Admin.Config
(
nodeTypeId
)
import
Gargantext.Database.Admin.Config
(
nodeTypeId
)
import
Gargantext.Database.Admin.Types.Node
-- (ListId, CorpusId, NodeId)
import
Gargantext.Database.Admin.Types.Node
-- (ListId, CorpusId, NodeId)
import
Gargantext.Database.Prelude
(
Cmd
,
runPGSQuery
)
import
Gargantext.Database.Prelude
(
Cmd
,
runPGSQuery
)
...
@@ -58,12 +56,6 @@ ngramsGroup l _m _n = Text.intercalate " "
...
@@ -58,12 +56,6 @@ ngramsGroup l _m _n = Text.intercalate " "
.
Text
.
replace
"-"
" "
.
Text
.
replace
"-"
" "
sortTficf
::
Ordering
->
(
Map
Text
(
Double
,
Set
Text
))
->
[
(
Text
,(
Double
,
Set
Text
))]
sortTficf
Down
=
List
.
sortOn
(
DO
.
Down
.
fst
.
snd
)
.
toList
sortTficf
Up
=
List
.
sortOn
(
fst
.
snd
)
.
toList
getTficf
::
UserCorpusId
getTficf
::
UserCorpusId
->
MasterCorpusId
->
MasterCorpusId
...
...
src/Gargantext/Text/List.hs
View file @
7d5b1cfc
...
@@ -21,7 +21,8 @@ import Gargantext.API.Ngrams (NgramsElement, mkNgramsElement, RootParent(..), mS
...
@@ -21,7 +21,8 @@ import Gargantext.API.Ngrams (NgramsElement, mkNgramsElement, RootParent(..), mS
-- import Gargantext.API.Ngrams.Tools (getCoocByNgrams', Diagonal(..))
-- import Gargantext.API.Ngrams.Tools (getCoocByNgrams', Diagonal(..))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core.Types
(
ListType
(
..
),
MasterCorpusId
,
UserCorpusId
,
Ordering
(
..
))
import
Gargantext.Core.Types
(
ListType
(
..
),
MasterCorpusId
,
UserCorpusId
,
Ordering
(
..
))
import
Gargantext.Database.Action.Metrics.NgramsByNode
(
getTficf
,
sortTficf
,
ngramsGroup
,
getNodesByNgramsUser
,
groupNodesByNgramsWith
)
import
Gargantext.Database.Action.Metrics.NgramsByNode
(
getTficf
,
ngramsGroup
,
getNodesByNgramsUser
,
groupNodesByNgramsWith
)
import
Gargantext.Text.Metrics.TFICF
(
sortTficf
)
import
Gargantext.Database.Prelude
(
Cmd
)
import
Gargantext.Database.Prelude
(
Cmd
)
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.Prelude
import
Gargantext.Prelude
...
@@ -199,7 +200,6 @@ toGargList stop l n = case stop n of
...
@@ -199,7 +200,6 @@ toGargList stop l n = case stop n of
False
->
(
l
,
n
)
False
->
(
l
,
n
)
isStopTerm
::
StopSize
->
Text
->
Bool
isStopTerm
::
StopSize
->
Text
->
Bool
isStopTerm
(
StopSize
n
)
x
=
Text
.
length
x
<
n
||
any
isStopChar
(
Text
.
unpack
x
)
isStopTerm
(
StopSize
n
)
x
=
Text
.
length
x
<
n
||
any
isStopChar
(
Text
.
unpack
x
)
where
where
...
...
src/Gargantext/Text/Metrics/TFICF.hs
View file @
7d5b1cfc
...
@@ -19,14 +19,20 @@ module Gargantext.Text.Metrics.TFICF ( TFICF
...
@@ -19,14 +19,20 @@ module Gargantext.Text.Metrics.TFICF ( TFICF
,
Total
(
..
)
,
Total
(
..
)
,
Count
(
..
)
,
Count
(
..
)
,
tficf
,
tficf
,
sortTficf
)
)
where
where
import
Data.Text
(
Text
)
import
Data.Text
(
Text
)
import
Gargantext.Prelude
import
Gargantext.Prelude
import
Data.Set
(
Set
)
import
Gargantext.Core.Types
(
Ordering
(
..
))
import
Data.Map.Strict
(
Map
,
toList
)
import
qualified
Data.Ord
as
DO
(
Down
(
..
))
import
qualified
Data.List
as
List
path
::
Text
path
::
Text
path
=
"
Gargantext.Text.Metrics.TFICF
"
path
=
"
[G.T.Metrics.TFICF]
"
type
TFICF
=
Double
type
TFICF
=
Double
...
@@ -47,3 +53,9 @@ tficf (TficfInfra (Count ic) (Total it) )
...
@@ -47,3 +53,9 @@ tficf (TficfInfra (Count ic) (Total it) )
tficf
_
_
=
panic
$
"[ERR]"
<>
path
<>
"Undefined for these contexts"
tficf
_
_
=
panic
$
"[ERR]"
<>
path
<>
"Undefined for these contexts"
sortTficf
::
Ordering
->
(
Map
Text
(
Double
,
Set
Text
))
->
[
(
Text
,(
Double
,
Set
Text
))]
sortTficf
Down
=
List
.
sortOn
(
DO
.
Down
.
fst
.
snd
)
.
toList
sortTficf
Up
=
List
.
sortOn
(
fst
.
snd
)
.
toList
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