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
04da4749
Commit
04da4749
authored
Jan 10, 2022
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] Requests with Contexts (WIP)
parent
51152a29
Changes
10
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
106 additions
and
108 deletions
+106
-108
Ngrams.hs
src/Gargantext/API/Ngrams.hs
+1
-1
List.hs
src/Gargantext/API/Ngrams/List.hs
+1
-1
Export.hs
src/Gargantext/API/Node/Corpus/Export.hs
+2
-2
List.hs
src/Gargantext/Core/Text/List.hs
+3
-3
Chart.hs
src/Gargantext/Core/Viz/Chart.hs
+4
-4
API.hs
src/Gargantext/Core/Viz/Graph/API.hs
+2
-2
Pairing.hs
src/Gargantext/Database/Action/Flow/Pairing.hs
+2
-2
Metrics.hs
src/Gargantext/Database/Action/Metrics.hs
+2
-2
NgramsByContext.hs
src/Gargantext/Database/Action/Metrics/NgramsByContext.hs
+85
-87
TFICF.hs
src/Gargantext/Database/Action/Metrics/TFICF.hs
+4
-4
No files found.
src/Gargantext/API/Ngrams.hs
View file @
04da4749
...
...
@@ -103,7 +103,7 @@ import Gargantext.Core.Mail.Types (HasMail)
import
Gargantext.Core.Types
(
ListType
(
..
),
NodeId
,
ListId
,
DocId
,
Limit
,
Offset
,
TODO
,
assertValid
,
HasInvalidError
)
import
Gargantext.API.Ngrams.Tools
import
Gargantext.Database.Action.Flow.Types
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
(
getOccByNgramsOnlyFast'
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
(
getOccByNgramsOnlyFast'
)
import
Gargantext.Database.Admin.Config
(
userMaster
)
import
Gargantext.Database.Admin.Types.Node
(
NodeType
(
..
))
import
Gargantext.Database.Prelude
(
HasConnectionPool
,
HasConfig
)
...
...
src/Gargantext/API/Ngrams/List.hs
View file @
04da4749
...
...
@@ -36,7 +36,7 @@ import Gargantext.Core.Text.Terms.WithList (buildPatterns, termsInText)
import
Gargantext.Core.Types.Main
(
ListType
(
..
))
import
Gargantext.Database.Action.Flow
(
saveDocNgramsWith
)
import
Gargantext.Database.Action.Flow.Types
(
FlowCmdM
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
(
getOccByNgramsOnlyFast'
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
(
getOccByNgramsOnlyFast'
)
import
Gargantext.Database.Admin.Types.Hyperdata.Document
import
Gargantext.Database.Admin.Types.Node
import
Gargantext.Database.Query.Table.NodeNode
(
selectDocNodes
)
...
...
src/Gargantext/API/Node/Corpus/Export.hs
View file @
04da4749
...
...
@@ -32,7 +32,7 @@ import Gargantext.API.Prelude (GargNoServer)
import
Gargantext.Prelude.Crypto.Hash
(
hash
)
import
Gargantext.Core.Types
import
Gargantext.Core.NodeStory
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
(
getNgramsByNode
OnlyUser
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
(
getNgramsByContext
OnlyUser
)
import
Gargantext.Database.Admin.Config
(
userMaster
)
import
Gargantext.Database.Admin.Types.Hyperdata
(
HyperdataDocument
(
..
))
import
Gargantext.Database.Prelude
(
Cmd
)
...
...
@@ -94,7 +94,7 @@ getNodeNgrams cId lId nt repo = do
lIds
<-
selectNodesWithUsername
NodeList
userMaster
let
ngs
=
filterListWithRoot
MapTerm
$
mapTermListRoot
[
lId
]
nt
repo
-- TODO HashMap
r
<-
getNgramsBy
Node
OnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
HashMap
.
keys
ngs
)
r
<-
getNgramsBy
Context
OnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
HashMap
.
keys
ngs
)
pure
r
-- TODO
...
...
src/Gargantext/Core/Text/List.hs
View file @
04da4749
...
...
@@ -34,7 +34,7 @@ import Gargantext.Core.Text.List.Social.Prelude
import
Gargantext.Core.Text.Metrics
(
scored'
,
Scored
(
..
),
scored_speExc
,
scored_genInc
,
normalizeGlobal
,
normalizeLocal
,
scored_terms
)
import
Gargantext.Core.Types
(
ListType
(
..
),
MasterCorpusId
,
UserCorpusId
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
(
getNodesByNgramsUser
,
getNode
sByNgramsOnlyUser
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
(
getContextsByNgramsUser
,
getContext
sByNgramsOnlyUser
)
import
Gargantext.Database.Action.Metrics.TFICF
(
getTficf_withSample
)
import
Gargantext.Database.Admin.Types.Node
(
NodeId
)
import
Gargantext.Database.Prelude
(
CmdM
)
...
...
@@ -98,7 +98,7 @@ buildNgramsOthersList :: ( HasNodeError err
->
(
NgramsType
,
MapListSize
)
->
m
(
Map
NgramsType
[
NgramsElement
])
buildNgramsOthersList
user
uCid
mfslw
_groupParams
(
nt
,
MapListSize
mapListSize
)
=
do
allTerms
::
HashMap
NgramsTerm
(
Set
NodeId
)
<-
get
Node
sByNgramsUser
uCid
nt
allTerms
::
HashMap
NgramsTerm
(
Set
NodeId
)
<-
get
Context
sByNgramsUser
uCid
nt
-- PrivateFirst for first developments since Public NodeMode is not implemented yet
socialLists
::
FlowCont
NgramsTerm
FlowListScores
...
...
@@ -212,7 +212,7 @@ buildNgramsTermsList user uCid mCid mfslw groupParams (nt, _mapListSize)= do
userListId
<-
defaultList
uCid
masterListId
<-
defaultList
mCid
mapTextDocIds
<-
get
Node
sByNgramsOnlyUser
uCid
mapTextDocIds
<-
get
Context
sByNgramsOnlyUser
uCid
[
userListId
,
masterListId
]
nt
selectedTerms
...
...
src/Gargantext/Core/Viz/Chart.hs
View file @
04da4749
...
...
@@ -36,7 +36,7 @@ import Gargantext.API.Ngrams.Tools
import
Gargantext.API.Ngrams.Types
import
Gargantext.Core.Types
import
Gargantext.Database.Action.Flow.Types
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
import
Gargantext.Database.Schema.Ngrams
import
Gargantext.Core.Viz.Types
import
qualified
Data.HashMap.Strict
as
HashMap
...
...
@@ -67,8 +67,8 @@ chartData cId nt lt = do
Nothing
->
x
Just
x'
->
maybe
x
identity
x'
(
_total
,
mapTerms
)
<-
count
Node
sByNgramsWith
(
group
dico
)
<$>
get
Node
sByNgramsOnlyUser
cId
(
ls'
<>
ls
)
nt
terms
(
_total
,
mapTerms
)
<-
count
Context
sByNgramsWith
(
group
dico
)
<$>
get
Context
sByNgramsOnlyUser
cId
(
ls'
<>
ls
)
nt
terms
let
(
dates
,
count
)
=
V
.
unzip
$
V
.
fromList
$
List
.
sortOn
snd
$
...
...
@@ -89,7 +89,7 @@ treeData cId nt lt = do
dico
=
filterListWithRoot
lt
ts
terms
=
catMaybes
$
List
.
concat
$
map
(
\
(
a
,
b
)
->
[
Just
a
,
b
])
$
HashMap
.
toList
dico
cs'
<-
get
Node
sByNgramsOnlyUser
cId
(
ls'
<>
ls
)
nt
terms
cs'
<-
get
Context
sByNgramsOnlyUser
cId
(
ls'
<>
ls
)
nt
terms
m
<-
getListNgrams
ls
nt
pure
$
V
.
fromList
$
toTree
lt
cs'
m
...
...
src/Gargantext/Core/Viz/Graph/API.hs
View file @
04da4749
...
...
@@ -31,7 +31,7 @@ import Gargantext.Core.Types.Main
import
Gargantext.Core.Viz.Graph
import
Gargantext.Core.Viz.Graph.GEXF
()
import
Gargantext.Core.Viz.Graph.Tools
-- (cooc2graph)
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
(
getNode
sByNgramsOnlyUser
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
(
getContext
sByNgramsOnlyUser
)
import
Gargantext.Database.Action.Flow.Types
(
FlowCmdM
)
import
Gargantext.Database.Action.Node
(
mkNodeWithParent
)
import
Gargantext.Database.Admin.Config
...
...
@@ -179,7 +179,7 @@ computeGraph cId d nt repo = do
-- <$> getCoocByNgrams (if d == Conditional then Diagonal True else Diagonal False)
<$>
getCoocByNgrams
(
Diagonal
True
)
<$>
groupNodesByNgrams
ngs
<$>
get
Node
sByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
HashMap
.
keys
ngs
)
<$>
get
Context
sByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
HashMap
.
keys
ngs
)
-- printDebug "myCooc" myCooc
-- saveAsFileDebug "debug/my-cooc" myCooc
...
...
src/Gargantext/Database/Action/Flow/Pairing.hs
View file @
04da4749
...
...
@@ -28,7 +28,7 @@ import Gargantext.Core
import
Gargantext.Core.Types
(
TableResult
(
..
))
import
Gargantext.Core.Types.Main
import
Gargantext.Database
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
(
getNode
sByNgramsOnlyUser
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
(
getContext
sByNgramsOnlyUser
)
import
Gargantext.Database.Admin.Config
import
Gargantext.Database.Admin.Types.Hyperdata
-- (HyperdataContact(..))
import
Gargantext.Database.Admin.Types.Node
-- (AnnuaireId, CorpusId, ListId, DocId, ContactId, NodeId)
...
...
@@ -190,4 +190,4 @@ getNgramsDocId cId lId nt = do
let
ngs
=
filterListWithRoot
MapTerm
$
mapTermListRoot
[
lId
]
nt
repo
groupNodesByNgrams
ngs
<$>
get
Node
sByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
HashMap
.
keys
ngs
)
<$>
get
Context
sByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
nt
(
HashMap
.
keys
ngs
)
src/Gargantext/Database/Action/Metrics.hs
View file @
04da4749
...
...
@@ -22,7 +22,7 @@ import Gargantext.Core.Mail.Types (HasMail)
import
Gargantext.Core.Types
(
ListType
(
..
),
Limit
,
NodeType
(
..
))
import
Gargantext.Core.NodeStory
import
Gargantext.Database.Action.Flow.Types
(
FlowCmdM
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
(
getNode
sByNgramsOnlyUser
{-, getTficfWith-}
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
(
getContext
sByNgramsOnlyUser
{-, getTficfWith-}
)
import
Gargantext.Database.Admin.Config
(
userMaster
)
import
Gargantext.Database.Admin.Types.Node
(
ListId
,
CorpusId
)
import
Gargantext.Database.Query.Table.Node
(
defaultList
)
...
...
@@ -57,7 +57,7 @@ getNgramsCooc cId maybeListId tabType maybeLimit = do
myCooc
<-
HM
.
filter
(
>
1
)
<$>
getCoocByNgrams
(
Diagonal
True
)
<$>
groupNodesByNgrams
ngs
<$>
get
Node
sByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
(
ngramsTypeFromTabType
tabType
)
<$>
get
Context
sByNgramsOnlyUser
cId
(
lIds
<>
[
lId
])
(
ngramsTypeFromTabType
tabType
)
(
take'
maybeLimit
$
HM
.
keys
ngs
)
pure
$
(
ngs'
,
ngs
,
myCooc
)
...
...
src/Gargantext/Database/Action/Metrics/NgramsBy
Node
.hs
→
src/Gargantext/Database/Action/Metrics/NgramsBy
Context
.hs
View file @
04da4749
This diff is collapsed.
Click to expand it.
src/Gargantext/Database/Action/Metrics/TFICF.hs
View file @
04da4749
...
...
@@ -21,10 +21,10 @@ import qualified Data.HashMap.Strict as HM
import
Data.Maybe
(
fromMaybe
)
import
Gargantext.Core
import
Gargantext.Core.Text.Metrics.TFICF
import
Gargantext.Database.Action.Metrics.NgramsBy
Node
(
getNode
sByNgramsUser
,
getOccByNgramsOnlyFast
,
getOccByNgramsOnlyFast_withSample
)
import
Gargantext.Database.Action.Metrics.NgramsBy
Context
(
getContext
sByNgramsUser
,
getOccByNgramsOnlyFast
,
getOccByNgramsOnlyFast_withSample
)
import
Gargantext.Database.Admin.Types.Node
-- (ListId, CorpusId, NodeId)
import
Gargantext.Database.Prelude
(
Cmd
)
import
Gargantext.Database.Query.Table.Node
Node
(
selectCountDocs
)
import
Gargantext.Database.Query.Table.Node
Context
(
selectCountDocs
)
import
Gargantext.Database.Schema.Ngrams
(
NgramsType
(
..
))
import
Gargantext.API.Ngrams.Types
import
Gargantext.Prelude
...
...
@@ -38,7 +38,7 @@ getTficf :: HasDBid NodeType
getTficf
cId
mId
nt
=
do
mapTextDoubleLocal
<-
HM
.
filter
(
>
1
)
<$>
HM
.
map
(
fromIntegral
.
Set
.
size
)
<$>
get
Node
sByNgramsUser
cId
nt
<$>
get
Context
sByNgramsUser
cId
nt
mapTextDoubleGlobal
<-
HM
.
map
fromIntegral
<$>
getOccByNgramsOnlyFast
mId
nt
(
HM
.
keys
mapTextDoubleLocal
)
...
...
@@ -62,7 +62,7 @@ getTficf_withSample :: HasDBid NodeType
getTficf_withSample
cId
mId
nt
=
do
mapTextDoubleLocal
<-
HM
.
filter
(
>
1
)
<$>
HM
.
map
(
fromIntegral
.
Set
.
size
)
<$>
get
Node
sByNgramsUser
cId
nt
<$>
get
Context
sByNgramsUser
cId
nt
countLocal
<-
selectCountDocs
cId
let
countGlobal
=
countLocal
*
10
...
...
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