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
0f2abe5f
Commit
0f2abe5f
authored
Jan 20, 2019
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Ngrams/Graph] inserted into lists.
parent
26fe8014
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
14 deletions
+13
-14
Flow.hs
src/Gargantext/Database/Flow.hs
+11
-12
TFICF.hs
src/Gargantext/Text/Metrics/TFICF.hs
+2
-2
No files found.
src/Gargantext/Database/Flow.hs
View file @
0f2abe5f
...
...
@@ -33,7 +33,9 @@ import Gargantext.Core.Types.Main
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Database.Config
(
userMaster
,
userArbitrary
,
corpusMasterName
)
import
Gargantext.Database.Flow.Utils
(
insertToNodeNgrams
)
import
Gargantext.Database.Metrics.TFICF
(
getTficf
)
import
Gargantext.Text.Terms
(
extractTerms
)
import
Gargantext.Text.Metrics.TFICF
(
Tficf
(
..
))
import
Gargantext.Database.Node.Document.Add
(
add
)
import
Gargantext.Database.Node.Document.Insert
(
insertDocuments
,
ReturnId
(
..
),
addUniqIdsDoc
,
addUniqIdsContact
,
ToDbData
(
..
))
import
Gargantext.Database.Root
(
getRoot
)
...
...
@@ -103,7 +105,7 @@ flowCorpus' :: HasNodeError err
flowCorpus'
NodeCorpus
hyperdataDocuments
(
ids
,
masterUserId
,
masterCorpusId
,
userId
,
userCorpusId
)
=
do
--------------------------------------------------
-- List Ngrams Flow
userListId
<-
flowListUser
userId
userCorpusId
userListId
<-
flowListUser
userId
userCorpusId
300
printDebug
"Working on User ListId : "
userListId
let
documentsWithId
=
mergeData
(
toInserted
ids
)
(
toInsert
hyperdataDocuments
)
...
...
@@ -280,11 +282,15 @@ flowList uId cId ngs = do
pure
lId
flowListUser
::
HasNodeError
err
=>
UserId
->
CorpusId
->
Cmd
err
NodeId
flowListUser
uId
cId
=
do
l
i
d
<-
getOrMkList
cId
uId
flowListUser
::
HasNodeError
err
=>
UserId
->
CorpusId
->
Int
->
Cmd
err
NodeId
flowListUser
uId
cId
n
=
do
l
I
d
<-
getOrMkList
cId
uId
-- is <- insertLists lId $ ngrams2list ngs
pure
lid
ngs
<-
take
n
<$>
sortWith
tficf_score
<$>
getTficf
userMaster
cId
lId
NgramsTerms
_
<-
insertNodeNgrams
[
NodeNgram
lId
(
tficf_ngramsId
ng
)
Nothing
(
ngramsTypeId
NgramsTerms
)
(
fromIntegral
$
listTypeId
GraphList
)
1
|
ng
<-
ngs
]
pure
lId
------------------------------------------------------------------------
...
...
@@ -323,10 +329,3 @@ insertLists lId lngs = insertNodeNgrams [ NodeNgram lId (_ngramsId ng) Nothing (
]
------------------------------------------------------------------------
src/Gargantext/Text/Metrics/TFICF.hs
View file @
0f2abe5f
...
...
@@ -26,7 +26,7 @@ data TficfContext n m = TficfLanguage n m | TficfCorpus n m | TficfDocument n m
data
Tficf
=
Tficf
{
tficf_ngramsId
::
NgramsId
,
tficf_ngramsTerms
::
NgramsTerms
,
tficf_score
::
Double
}
}
deriving
(
Show
)
type
SupraContext
=
TficfContext
...
...
@@ -41,7 +41,7 @@ tficf _ _ = panic "Not in definition"
tficf'
::
Double
->
Double
->
Double
->
Double
->
Double
tficf'
c
c'
l
l'
|
c
<=
c'
&&
l
<
l'
=
(
c
/
c'
)
/
log
(
l
/
l
'
)
|
c
<=
c'
&&
l
<
l'
=
(
l
/
l'
)
/
log
(
c
/
c
'
)
|
otherwise
=
panic
"Frequency impossible"
...
...
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