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
e16a2824
Commit
e16a2824
authored
Sep 10, 2020
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TextFlow] Work on metrics
parent
63f55442
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
49 deletions
+11
-49
List.hs
src/Gargantext/Core/Text/List.hs
+6
-47
TFICF.hs
src/Gargantext/Core/Text/Metrics/TFICF.hs
+4
-1
TFICF.hs
src/Gargantext/Database/Action/Metrics/TFICF.hs
+1
-1
No files found.
src/Gargantext/Core/Text/List.hs
View file @
e16a2824
...
...
@@ -91,47 +91,6 @@ buildNgramsOthersList uCid groupIt nt = do
]
)]
{-
buildNgramsTermsList' :: UserCorpusId
-> (Text -> Text)
-> ((Text, (Set Text, Set NodeId)) -> Bool)
-> Int
-> Int
-> Cmd err (Map NgramsType [NgramsElement])
buildNgramsTermsList' uCid groupIt stop gls is = do
ngs <- groupNodesByNgramsWith groupIt <$> getNodesByNgramsUser uCid NgramsTerms
let
(stops, candidates) = partitionEithers
$ map (\t -> if stop t then Left t else Right t)
$ Map.toList
$ Map.filter ((\s' -> Set.size s' > 1) . snd) ngs
(maps, candidates') = takeScored gls is
$ getCoocByNgrams' snd (Diagonal True)
$ Map.fromList candidates
toList' t = (fst t, (fromIntegral $ Set.size $ snd $ snd t, fst $ snd t))
(s,c,m) = (stops
, List.filter (\(k,_) -> List.elem k candidates') candidates
, List.filter (\(k,_) -> List.elem k maps) candidates
)
let ngs' = List.concat
$ map toNgramsElement
$ map (\t -> (StopTerm , toList' t)) s
<> map (\t -> (CandidateTerm, toList' t)) c
<> map (\t -> (MapTerm , toList' t)) m
pure $ Map.fromList [(NgramsTerms, ngs')]
-}
buildNgramsTermsList
::
Lang
->
Int
->
Int
...
...
@@ -149,12 +108,12 @@ buildNgramsTermsList _l _n _m s uCid mCid = do
candidatesHead
=
List
.
take
candidatesSize
candidates
candidatesTail
=
List
.
drop
candidatesSize
candidates
termList
=
-- (toTermList a b ((isStopTerm s) . fst) candidatesHead)
(
map
(
toGargList
((
isStopTerm
s
)
.
fst
)
MapTerm
)
candidatesHead
)
termList
=
(
map
(
toGargList
((
isStopTerm
s
)
.
fst
)
MapTerm
)
candidatesHead
)
<>
(
map
(
toGargList
((
isStopTerm
s
)
.
fst
)
CandidateTerm
)
candidatesTail
)
ngs
=
List
.
concat
$
map
toNgramsElement
$
map
(
\
(
lt
,
(
t
,
d
))
->
(
lt
,
((
t
,
(
d
,
Set
.
singleton
t
)))))
termList
ngs
=
List
.
concat
$
map
toNgramsElement
$
map
(
\
(
lt
,
(
t
,
d
))
->
(
lt
,
((
t
,
(
d
,
Set
.
singleton
t
)))))
termList
pure
$
Map
.
fromList
[(
NgramsTerms
,
ngs
)]
...
...
@@ -194,7 +153,7 @@ toNgramsElement (listType, (_stem, (_score, setNgrams))) =
toGargList
::
(
b
->
Bool
)
->
ListType
->
b
->
(
ListType
,
b
)
toGargList
stop
l
n
=
case
s
top
n
of
toGargList
isStop
l
n
=
case
isS
top
n
of
True
->
(
StopTerm
,
n
)
False
->
(
l
,
n
)
...
...
src/Gargantext/Core/Text/Metrics/TFICF.hs
View file @
e16a2824
...
...
@@ -48,7 +48,10 @@ tficf :: TficfContext Count Total
tficf
(
TficfInfra
(
Count
ic
)
(
Total
it
)
)
(
TficfSupra
(
Count
sc
)
(
Total
st
)
)
|
it
>=
ic
&&
st
>=
sc
&&
it
<=
st
=
(
it
/
ic
)
*
log
(
st
/
sc
)
|
otherwise
=
panic
$
"[ERR]"
<>
path
<>
" Frequency impossible"
|
otherwise
=
panic
$
"[ERR]"
<>
path
<>
" Frequency impossible"
tficf
_
_
=
panic
$
"[ERR]"
<>
path
<>
"Undefined for these contexts"
...
...
src/Gargantext/Database/Action/Metrics/TFICF.hs
View file @
e16a2824
...
...
@@ -34,7 +34,7 @@ getTficf :: UserCorpusId
->
NgramsType
->
Cmd
err
(
Map
Text
Double
)
getTficf
cId
mId
nt
=
do
mapTextDoubleLocal
<-
Map
.
filter
(
>
2
)
mapTextDoubleLocal
<-
Map
.
filter
(
>
1
)
<$>
Map
.
map
(
fromIntegral
.
Set
.
size
)
<$>
getNodesByNgramsUser
cId
nt
...
...
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