Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
humanities
gargantext
Commits
55485f8e
Commit
55485f8e
authored
Sep 08, 2017
by
Alexandre Delanoë
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/simon-unstable-lists-fix' into unstable
parents
77257dfd
889e4fc9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
ngramlists_tools.py
gargantext/util/ngramlists_tools.py
+10
-7
ngramlists.py
gargantext/views/api/ngramlists.py
+5
-0
No files found.
gargantext/util/ngramlists_tools.py
View file @
55485f8e
...
...
@@ -745,12 +745,15 @@ def merge_ngramlists(new_lists={}, onto_corpus=None, del_originals=[]):
# ======== Merging old and new groups =========
# get the arcs already in the target DB (directed couples)
previous_links
=
session
.
query
(
NodeNgramNgram
.
ngram1_id
,
NodeNgramNgram
.
ngram2_id
)
.
filter
(
NodeNgramNgram
.
node_id
==
old_group_id
)
.
all
()
if
'groupings'
in
del_originals
:
previous_links
=
[]
else
:
previous_links
=
session
.
query
(
NodeNgramNgram
.
ngram1_id
,
NodeNgramNgram
.
ngram2_id
)
.
filter
(
NodeNgramNgram
.
node_id
==
old_group_id
)
.
all
()
n_links_previous
=
len
(
previous_links
)
...
...
@@ -851,7 +854,7 @@ def import_and_merge_ngramlists(file_contents, onto_corpus_id, overwrite=False):
corpus_node
=
session
.
query
(
Node
)
.
get
(
onto_corpus_id
)
# merge the new_lists onto those of the target corpus
del_originals
=
[
'stop'
,
'main'
,
'map'
]
if
overwrite
else
[]
del_originals
=
[
'stop'
,
'main'
,
'map'
,
'groupings'
]
if
overwrite
else
[]
log_msg
=
merge_ngramlists
(
new_lists
,
onto_corpus
=
corpus_node
,
del_originals
=
del_originals
)
return
log_msg
gargantext/views/api/ngramlists.py
View file @
55485f8e
...
...
@@ -155,7 +155,12 @@ class CSVLists(APIView):
try
:
# merge the source_lists onto those of the target corpus
delete
=
todo_lists
if
bool
(
params
.
get
(
'overwrite'
))
else
[]
if
len
(
delete
)
==
len
(
list_types
):
delete
.
append
(
'groupings'
)
log_msg
=
merge_ngramlists
(
source_lists
,
onto_corpus
=
corpus_node
,
del_originals
=
delete
)
return
JsonHttpResponse
({
'log'
:
log_msg
,
},
200
)
...
...
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