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
158
Issues
158
List
Board
Labels
Milestones
Merge Requests
11
Merge Requests
11
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
3da16377
Commit
3da16377
authored
Jan 08, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[TEXTFLOW] enriched ngrams connected
parent
5f6b2708
Pipeline
#1334
failed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
9 deletions
+15
-9
Core.hs
src/Gargantext/Core.hs
+3
-3
Terms.hs
src/Gargantext/Core/Text/Terms.hs
+7
-0
Flow.hs
src/Gargantext/Database/Action/Flow.hs
+4
-5
NgramsPostag.hs
src/Gargantext/Database/Query/Table/NgramsPostag.hs
+1
-1
No files found.
src/Gargantext/Core.hs
View file @
3da16377
...
...
@@ -68,12 +68,12 @@ instance HasDBid Lang where
fromDBid
_
=
panic
"HasDBid lang, not implemented"
------------------------------------------------------------------------
data
Pos
t
TagAlgo
=
CoreNLP
data
PosTagAlgo
=
CoreNLP
deriving
(
Show
,
Read
,
Eq
,
Ord
,
Generic
)
instance
Hashable
Pos
t
TagAlgo
instance
Hashable
PosTagAlgo
instance
HasDBid
Pos
t
TagAlgo
where
instance
HasDBid
PosTagAlgo
where
toDBid
CoreNLP
=
1
fromDBid
1
=
CoreNLP
fromDBid
_
=
panic
"HasDBid posTagAlgo : Not implemented"
...
...
src/Gargantext/Core/Text/Terms.hs
View file @
3da16377
...
...
@@ -126,7 +126,14 @@ class ExtractNgramsT h
->
h
->
Cmd
err
(
HashMap
ExtractedNgrams
(
Map
NgramsType
Int
))
------------------------------------------------------------------------
enrichedTerms
::
Lang
->
PosTagAlgo
->
POS
->
Terms
->
NgramsPostag
enrichedTerms
l
pa
po
(
Terms
ng1
ng2
)
=
NgramsPostag
l
pa
po
form
lem
where
form
=
text2ngrams
$
Text
.
intercalate
" "
ng1
lem
=
text2ngrams
$
Text
.
intercalate
" "
$
Set
.
toList
ng2
------------------------------------------------------------------------
cleanNgrams
::
Int
->
Ngrams
->
Ngrams
cleanNgrams
s
ng
|
Text
.
length
(
ng
^.
ngramsTerms
)
<
s
=
ng
...
...
src/Gargantext/Database/Action/Flow.hs
View file @
3da16377
...
...
@@ -63,7 +63,7 @@ import qualified Data.HashMap.Strict as HashMap
import
qualified
Gargantext.Data.HashMap.Strict.Utils
as
HashMap
import
qualified
Data.Map
as
Map
import
Gargantext.Core
(
Lang
(
..
))
import
Gargantext.Core
(
Lang
(
..
)
,
PosTagAlgo
(
..
)
)
import
Gargantext.Core.Ext.IMT
(
toSchoolName
)
import
Gargantext.Core.Ext.IMTUser
(
deserialiseImtUsersFromFile
)
import
Gargantext.Core.Flow.Types
...
...
@@ -73,7 +73,7 @@ import Gargantext.Core.Text.Corpus.Parsers (parseFile, FileFormat)
import
Gargantext.Core.Text.List
(
buildNgramsLists
)
import
Gargantext.Core.Text.Terms
import
Gargantext.Core.Text.Terms.Mono.Stem.En
(
stemIt
)
import
Gargantext.Core.Types
(
Terms
(
..
))
import
Gargantext.Core.Types
(
Terms
(
..
)
,
POS
(
NP
)
)
import
Gargantext.Core.Types.Individu
(
User
(
..
))
import
Gargantext.Core.Types.Main
import
Gargantext.Core.Utils.Prefix
(
unPrefix
,
unPrefixSwagger
)
...
...
@@ -409,15 +409,14 @@ instance ExtractNgramsT HyperdataDocument
$
maybe
[
"Nothing"
]
(
splitOn
", "
)
$
_hd_authors
doc
terms'
<-
map
text2ngrams
<$>
map
(
intercalate
" "
.
_terms_label
)
terms'
<-
map
(
enrichedTerms
(
lang'
^.
tt_lang
)
CoreNLP
NP
)
<$>
concat
<$>
liftBase
(
extractTerms
lang'
$
hasText
doc
)
pure
$
HashMap
.
fromList
$
[(
SimpleNgrams
source
,
Map
.
singleton
Sources
1
)]
<>
[(
SimpleNgrams
i'
,
Map
.
singleton
Institutes
1
)
|
i'
<-
institutes
]
<>
[(
SimpleNgrams
a'
,
Map
.
singleton
Authors
1
)
|
a'
<-
authors
]
<>
[(
Simple
Ngrams
t'
,
Map
.
singleton
NgramsTerms
1
)
|
t'
<-
terms'
]
<>
[(
Enriched
Ngrams
t'
,
Map
.
singleton
NgramsTerms
1
)
|
t'
<-
terms'
]
instance
(
ExtractNgramsT
a
,
HasText
a
)
=>
ExtractNgramsT
(
Node
a
)
where
...
...
src/Gargantext/Database/Query/Table/NgramsPostag.hs
View file @
3da16377
...
...
@@ -33,7 +33,7 @@ import qualified Database.PostgreSQL.Simple as PGS
data
NgramsPostag
=
NgramsPostag
{
_np_lang
::
Lang
,
_np_algo
::
Pos
t
TagAlgo
,
_np_algo
::
PosTagAlgo
,
_np_postag
::
POS
,
_np_form
::
Ngrams
,
_np_lem
::
Ngrams
...
...
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