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
777cf4cc
Commit
777cf4cc
authored
Jan 20, 2021
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FIX] clean groups + handling duplicates (TODO inside)
parent
e55c6044
Pipeline
#1360
failed with stage
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
5 deletions
+9
-5
schema.sql
devops/postgres/schema.sql
+1
-1
Types.hs
src/Gargantext/API/Ngrams/Types.hs
+1
-0
WithStem.hs
src/Gargantext/Core/Text/List/Group/WithStem.hs
+4
-2
NgramsPostag.hs
src/Gargantext/Database/Query/Table/NgramsPostag.hs
+3
-2
No files found.
devops/postgres/schema.sql
View file @
777cf4cc
...
@@ -59,7 +59,7 @@ CREATE TABLE public.ngrams_postag (
...
@@ -59,7 +59,7 @@ CREATE TABLE public.ngrams_postag (
lemm_id
INTEGER
NOT
NULL
,
lemm_id
INTEGER
NOT
NULL
,
score
INTEGER
DEFAULT
1
::
integer
NOT
NULL
,
score
INTEGER
DEFAULT
1
::
integer
NOT
NULL
,
FOREIGN
KEY
(
ngrams_id
)
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
ngrams_id
)
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
,
FOREIGN
KEY
(
lemm_id
)
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
FOREIGN
KEY
(
lemm_id
)
REFERENCES
public
.
ngrams
(
id
)
ON
DELETE
CASCADE
);
);
ALTER
TABLE
public
.
ngrams_postag
OWNER
TO
gargantua
;
ALTER
TABLE
public
.
ngrams_postag
OWNER
TO
gargantua
;
...
...
src/Gargantext/API/Ngrams/Types.hs
View file @
777cf4cc
...
@@ -127,6 +127,7 @@ instance (ToJSONKey a, ToSchema a) => ToSchema (MSet a) where
...
@@ -127,6 +127,7 @@ instance (ToJSONKey a, ToSchema a) => ToSchema (MSet a) where
newtype
NgramsTerm
=
NgramsTerm
{
unNgramsTerm
::
Text
}
newtype
NgramsTerm
=
NgramsTerm
{
unNgramsTerm
::
Text
}
deriving
(
Ord
,
Eq
,
Show
,
Generic
,
ToJSONKey
,
ToJSON
,
FromJSON
,
Semigroup
,
Arbitrary
,
Serialise
,
ToSchema
,
Hashable
)
deriving
(
Ord
,
Eq
,
Show
,
Generic
,
ToJSONKey
,
ToJSON
,
FromJSON
,
Semigroup
,
Arbitrary
,
Serialise
,
ToSchema
,
Hashable
)
instance
IsHashable
NgramsTerm
where
instance
IsHashable
NgramsTerm
where
hash
(
NgramsTerm
t
)
=
hash
t
hash
(
NgramsTerm
t
)
=
hash
t
...
...
src/Gargantext/Core/Text/List/Group/WithStem.hs
View file @
777cf4cc
...
@@ -88,8 +88,10 @@ groupWith (GroupParams l _m _n _) t =
...
@@ -88,8 +88,10 @@ groupWith (GroupParams l _m _n _) t =
-- | This lemmatization group done with CoreNLP algo (or others)
-- | This lemmatization group done with CoreNLP algo (or others)
groupWith
(
GroupWithPosTag
_
_
m
)
t
=
groupWith
(
GroupWithPosTag
_
_
m
)
t
=
case
HashMap
.
lookup
(
unNgramsTerm
t
)
m
of
case
HashMap
.
lookup
(
unNgramsTerm
t
)
m
of
Nothing
->
t
Nothing
->
clean
t
Just
t'
->
NgramsTerm
t'
Just
t'
->
clean
$
NgramsTerm
t'
where
clean
(
NgramsTerm
t
)
=
NgramsTerm
$
Text
.
replace
"-"
" "
t
--------------------------------------------------------------------
--------------------------------------------------------------------
stemPatches
::
GroupParams
stemPatches
::
GroupParams
...
...
src/Gargantext/Database/Query/Table/NgramsPostag.hs
View file @
777cf4cc
...
@@ -140,11 +140,12 @@ queryInsertNgramsPostag = [sql|
...
@@ -140,11 +140,12 @@ queryInsertNgramsPostag = [sql|
FROM input_rows ir
FROM input_rows ir
JOIN ins_form_ret form ON form.terms = ir.form
JOIN ins_form_ret form ON form.terms = ir.form
JOIN ins_lem_ret lem ON lem.terms = ir.lem
JOIN ins_lem_ret lem ON lem.terms = ir.lem
-- GROUP BY ir.lang_id, ir.algo_id, ir.postag, form.id, lem.id
-- GROUP BY ir.lang_id, ir.algo_id, ir.postag, form.id, lem.id
-- ORDER BY s DESC
-- ORDER BY s DESC
-- LIMIT 1
-- LIMIT 1
ON CONFLICT (lang_id,algo_id,postag,ngrams_id,lemm_id)
ON CONFLICT (lang_id,algo_id,postag,ngrams_id,lemm_id)
DO UPDATE SET score = ngrams_postag.score + 1
DO NOTHING -- acceptable for now since we are using NP mainly
-- DO UPDATE SET score = ngrams_postag.score + 1
)
)
SELECT terms,id FROM ins_form_ret
SELECT terms,id FROM ins_form_ret
...
...
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