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
0a5ed94b
Commit
0a5ed94b
authored
Oct 04, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEAT] coocs: last details ready on new sql version (ok for testing merge) (bug-16)
parent
4ef11b73
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
2 deletions
+22
-2
ngram_coocs.py
gargantext/util/toolchain/ngram_coocs.py
+22
-2
No files found.
gargantext/util/toolchain/ngram_coocs.py
View file @
0a5ed94b
...
@@ -200,8 +200,20 @@ def compute_coocs( corpus,
...
@@ -200,8 +200,20 @@ def compute_coocs( corpus,
"""
"""
if
stoplist_id
:
if
stoplist_id
:
pass
# used for reverse join
# TODO reverse join
sql_statement
+=
"""
LEFT JOIN (
SELECT * FROM nodes_ngrams
WHERE nodes_ngrams.node_id =
%
i
) AS stoplistA
ON stoplistA.ngram_id = cooc.ngA
LEFT JOIN (
SELECT * FROM nodes_ngrams
WHERE nodes_ngrams.node_id =
%
i
) AS stoplistB
ON stoplistA.ngram_id = cooc.ngA
"""
%
(
stoplist_id
,
stoplist_id
)
# 7) FILTERS
# 7) FILTERS
...
@@ -213,6 +225,11 @@ def compute_coocs( corpus,
...
@@ -213,6 +225,11 @@ def compute_coocs( corpus,
sql_statement
+=
"
\n
AND whitelistA.node_id =
%
i"
%
on_list_id
sql_statement
+=
"
\n
AND whitelistA.node_id =
%
i"
%
on_list_id
sql_statement
+=
"
\n
AND whitelistB.node_id =
%
i"
%
on_list_id
sql_statement
+=
"
\n
AND whitelistB.node_id =
%
i"
%
on_list_id
if
stoplist_id
:
sql_statement
+=
"
\n
AND stoplistA.ngram_id IS NULL"
sql_statement
+=
"
\n
AND stoplistB.ngram_id IS NULL"
# don't compute ngram with itself
# don't compute ngram with itself
# NB: this option is bad for main toolchain
# NB: this option is bad for main toolchain
if
diagonal_filter
:
if
diagonal_filter
:
...
@@ -227,6 +244,9 @@ def compute_coocs( corpus,
...
@@ -227,6 +244,9 @@ def compute_coocs( corpus,
# 6) EXECUTE QUERY
# 6) EXECUTE QUERY
# ----------------
# ----------------
# debug
print
(
sql_statement
)
# executing the SQL statement
# executing the SQL statement
results
=
connection
.
execute
(
sql_statement
)
results
=
connection
.
execute
(
sql_statement
)
...
...
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