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
d9c0428f
Commit
d9c0428f
authored
Nov 12, 2015
by
delanoe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[SOME FIX]
parent
6845ac3e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
2 deletions
+66
-2
cooccurrences.py
analysis/cooccurrences.py
+1
-1
functions.py
analysis/functions.py
+1
-1
workflow.py
workflow.py
+64
-0
No files found.
analysis/cooccurrences.py
View file @
d9c0428f
...
@@ -91,7 +91,7 @@ def do_cooc(corpus=None
...
@@ -91,7 +91,7 @@ def do_cooc(corpus=None
.
filter
(
Node
.
parent_id
==
corpus
.
id
,
Node
.
type_id
==
doc_id
)
.
filter
(
Node
.
parent_id
==
corpus
.
id
,
Node
.
type_id
==
doc_id
)
.
filter
(
Hyperdata
.
name
==
field1
)
.
filter
(
Hyperdata
.
name
==
field1
)
)
)
print
(
cooc_query
)
#
print(cooc_query)
# Size of the ngrams between n_min and n_max
# Size of the ngrams between n_min and n_max
if
n_min
is
not
None
or
n_max
is
not
None
:
if
n_min
is
not
None
or
n_max
is
not
None
:
...
...
analysis/functions.py
View file @
d9c0428f
...
@@ -112,7 +112,7 @@ def do_distance(cooc_id, field1=None, field2=None, isMonopartite=True):
...
@@ -112,7 +112,7 @@ def do_distance(cooc_id, field1=None, field2=None, isMonopartite=True):
return
item
[
1
]
return
item
[
1
]
node_degree
=
sorted
(
G
.
degree
()
.
items
(),
key
=
getWeight
,
reverse
=
True
)
node_degree
=
sorted
(
G
.
degree
()
.
items
(),
key
=
getWeight
,
reverse
=
True
)
print
(
node_degree
)
#
print(node_degree)
nodes_too_connected
=
[
n
[
0
]
for
n
in
node_degree
[
0
:(
round
(
len
(
node_degree
)
/
5
))]]
nodes_too_connected
=
[
n
[
0
]
for
n
in
node_degree
[
0
:(
round
(
len
(
node_degree
)
/
5
))]]
for
n
in
nodes_too_connected
:
for
n
in
nodes_too_connected
:
...
...
workflow.py
0 → 100644
View file @
d9c0428f
from
admin.env
import
*
from
ngram.tfidf
import
compute_tfidf
,
compute_tfidf_global
from
ngram.cvalue
import
compute_cvalue
from
ngram.specificity
import
compute_specificity
from
ngram.stop
import
compute_stop
from
ngram.group
import
compute_groups
from
gargantext_web.db
import
get_or_create_node
from
ngram.mapList
import
compute_mapList
from
gargantext_web.db
import
NodeNgram
#from gargantext_web.celery import update_processing
def
ngram_workflow
(
corpus
,
n
=
5000
):
'''
All the workflow to filter the ngrams.
'''
compute_stop
(
corpus
)
compute_tfidf_global
(
corpus
)
part
=
round
(
n
*
0.9
)
compute_cvalue
(
corpus
,
limit
=
1000
)
# size
part
=
round
(
part
*
0.8
)
print
(
'spec part:'
,
part
)
compute_specificity
(
corpus
,
limit
=
part
)
part
=
round
(
part
*
0.8
)
limit_inf
=
round
(
part
*
1
)
limit_sup
=
round
(
part
*
5
)
print
(
limit_inf
,
limit_sup
)
compute_groups
(
corpus
,
limit_inf
=
limit_inf
,
limit_sup
=
limit_sup
)
compute_mapList
(
corpus
,
limit
=
1000
)
# size
compute_tfidf
(
corpus
)
node_id
=
1427298
#corpus=session.query(Node).filter(Node.id==540420).first()
corpus
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
node_id
)
.
first
()
ngram_workflow
(
corpus
)
#update_processing(corpus, 0)
check_stop
=
False
if
check_stop
:
stop
=
get_or_create_node
(
corpus
=
corpus
,
nodetype
=
'StopList'
)
#session.query(NodeNgram).filter(NodeNgram.node_id==stop.id).delete()
#session.commit()
stop_ngrams
=
(
session
.
query
(
Ngram
)
.
join
(
NodeNgram
,
NodeNgram
.
ngram_id
==
Ngram
.
id
)
.
filter
(
NodeNgram
.
node_id
==
stop
.
id
)
.
all
()
)
print
([
n
for
n
in
stop_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