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
6e151202
Commit
6e151202
authored
Jul 26, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unstable' into romain-new (get new graph save options)
parents
0ccc7b69
911725bf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
graph.py
graph/graph.py
+13
-0
rest.py
graph/rest.py
+17
-1
project.html
templates/pages/projects/project.html
+1
-1
No files found.
graph/graph.py
View file @
6e151202
...
...
@@ -23,6 +23,7 @@ def get_graph( request=None , corpus=None
,
distance
=
'conditional'
,
isMonopartite
=
True
# By default, we compute terms/terms graph
,
bridgeness
=
5
,
saveOnly
=
None
#, size=1000
):
'''
...
...
@@ -113,6 +114,18 @@ def get_graph( request=None , corpus=None
# Finally test if the size of the corpora is big enough
# --------------------------------
corpus_size
=
corpus_size_query
.
count
()
if
saveOnly
is
not
None
and
saveOnly
==
"True"
:
scheduled
(
countCooccurrences
)(
corpus_id
=
corpus
.
id
#, field1="ngrams", field2="ngrams"
,
start
=
start
,
end
=
end
,
mapList_id
=
mapList_id
,
groupList_id
=
groupList_id
,
isMonopartite
=
True
,
threshold
=
threshold
,
save_on_db
=
True
#, limit=size
)
return
{
"state"
:
"saveOnly"
}
if
corpus_size
>
graph_constraints
[
'corpusMax'
]:
# Then compute cooc asynchronously with celery
scheduled
(
countCooccurrences
)(
corpus_id
=
corpus
.
id
...
...
graph/rest.py
View file @
6e151202
...
...
@@ -67,6 +67,7 @@ class Graph(APIView):
# Get all the parameters in the URL
cooc_id
=
request
.
GET
.
get
(
'cooc_id'
,
None
)
saveOnly
=
request
.
GET
.
get
(
'saveOnly'
,
None
)
field1
=
str
(
request
.
GET
.
get
(
'field1'
,
'ngrams'
))
field2
=
str
(
request
.
GET
.
get
(
'field2'
,
'ngrams'
))
...
...
@@ -131,6 +132,7 @@ class Graph(APIView):
,
mapList_id
=
mapList_id
,
groupList_id
=
groupList_id
,
start
=
start
,
end
=
end
,
threshold
=
threshold
,
distance
=
distance
,
saveOnly
=
saveOnly
)
else
:
data
=
get_graph
(
corpus
=
corpus
,
cooc_id
=
cooc_id
...
...
@@ -139,6 +141,7 @@ class Graph(APIView):
,
threshold
=
threshold
,
distance
=
distance
,
bridgeness
=
bridgeness
,
saveOnly
=
saveOnly
)
...
...
@@ -158,7 +161,17 @@ class Graph(APIView):
else
:
# All other cases (more probable are higher in the if list)
if
data
[
"state"
]
==
"corpusMin"
:
if
data
[
"state"
]
==
"saveOnly"
:
# async data case
return
JsonHttpResponse
({
'msg'
:
'''Your graph is saved:
http://
%
sgargantext.org/projects/
%
d/corpora/
%
d/myGraphs
'''
%
(
"dev."
,
corpus
.
parent_id
,
corpus
.
id
),
},
status
=
400
)
elif
data
[
"state"
]
==
"corpusMin"
:
# async data case
return
JsonHttpResponse
({
'msg'
:
'''Problem: your corpus is too small (only
%
d documents).
...
...
@@ -208,6 +221,9 @@ class Graph(APIView):
http://
%
sgargantext.org/projects/
%
d/corpora/
%
d/myGraphs
'''
%
(
data
[
"length"
],
"dev."
,
corpus
.
parent_id
,
corpus
.
id
),
},
status
=
400
)
else
:
return
JsonHttpResponse
({
'msg'
:
'''Programming error.'''
,
...
...
templates/pages/projects/project.html
View file @
6e151202
...
...
@@ -114,6 +114,7 @@
<span
class=
"glyphicon glyphicon-repeat"
aria-hidden=
"true"
title=
'Recalculate ngram scores and similarities'
></span>
</button>
{% endif %}
<!-- TODO: delete non seulement si state.complete mais aussi si state.error -->
<button
type=
"button"
class=
"btn btn-default"
data-container=
"body"
data-toggle=
"popover"
data-placement=
"bottom"
...
...
@@ -131,7 +132,6 @@
<span
class=
"glyphicon glyphicon-trash"
aria-hidden=
"true"
title=
'Delete this corpus'
></span>
</button>
{% endif %}
{% endifequal %}
{% endfor %}
</div>
...
...
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