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
983d5fb0
Commit
983d5fb0
authored
Oct 03, 2016
by
Romain Loth
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'testing' into romain-testing
parents
3fc8e763
d3bb8c17
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
160 additions
and
91 deletions
+160
-91
cooccurrences.py
graph/cooccurrences.py
+3
-4
graph.py
graph/graph.py
+5
-0
views.py
graph/views.py
+0
-3
myGraphs.html
templates/pages/corpora/myGraphs.html
+151
-83
menu.html
templates/pages/menu.html
+1
-1
No files found.
graph/cooccurrences.py
View file @
983d5fb0
...
@@ -219,10 +219,9 @@ def countCooccurrences( corpus_id=None , cooc_id=None
...
@@ -219,10 +219,9 @@ def countCooccurrences( corpus_id=None , cooc_id=None
print
(
"GRAPH #
%
s ... Parameters saved in Node."
%
cooc_id
)
print
(
"GRAPH #
%
s ... Parameters saved in Node."
%
cooc_id
)
coocNode
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
cooc_id
)
.
first
()
coocNode
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
cooc_id
)
.
first
()
coocNode
.
hyperdata
[
distance
]
=
dict
()
coocNode
.
hyperdata
[
"parameters"
]
=
dict
()
coocNode
.
hyperdata
[
distance
][
"parameters"
]
=
parameters
coocNode
.
hyperdata
[
"parameters"
]
=
parameters
coocNode
.
save_hyperdata
()
session
.
add
(
coocNode
)
session
.
commit
()
session
.
commit
()
#data = cooc2graph(coocNode.id, cooc, distance=distance, bridgeness=bridgeness)
#data = cooc2graph(coocNode.id, cooc, distance=distance, bridgeness=bridgeness)
...
...
graph/graph.py
View file @
983d5fb0
...
@@ -69,9 +69,14 @@ def compute_graph( corpus_id=None , cooc_id=None
...
@@ -69,9 +69,14 @@ def compute_graph( corpus_id=None , cooc_id=None
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
cooc_id
)
.
first
()
node
=
session
.
query
(
Node
)
.
filter
(
Node
.
id
==
cooc_id
)
.
first
()
if
node
.
hyperdata
.
get
(
distance
,
None
)
is
None
:
if
node
.
hyperdata
.
get
(
distance
,
None
)
is
None
:
print
(
"GRAPH #
%
d ... Distance
%
s has not been computed already."
%
(
cooc_id
,
distance
))
node
.
hyperdata
[
distance
]
=
dict
()
node
.
hyperdata
[
distance
]
=
dict
()
node
.
hyperdata
[
distance
][
bridgeness
]
=
data
node
.
hyperdata
[
distance
][
bridgeness
]
=
data
node
.
hyperdata
[
distance
][
"nodes"
]
=
len
(
G
.
nodes
())
node
.
hyperdata
[
distance
][
"edges"
]
=
len
(
G
.
edges
())
node
.
save_hyperdata
()
node
.
save_hyperdata
()
session
.
commit
()
session
.
commit
()
...
...
graph/views.py
View file @
983d5fb0
...
@@ -75,9 +75,6 @@ def myGraphs(request, project_id, corpus_id):
...
@@ -75,9 +75,6 @@ def myGraphs(request, project_id, corpus_id):
.
all
()
.
all
()
)
)
#for n in cooc_nodes:
# print(n)
#coocs_count[cooc.id] = len(cooc_nodes)
#coocs_count[cooc.id] = len(cooc_nodes)
coocs_count
[
cooc
.
id
]
=
len
([
cooc_node
for
cooc_node
in
cooc_nodes
if
cooc_node
[
1
]
>
1
])
coocs_count
[
cooc
.
id
]
=
len
([
cooc_node
for
cooc_node
in
cooc_nodes
if
cooc_node
[
1
]
>
1
])
...
...
templates/pages/corpora/myGraphs.html
View file @
983d5fb0
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
<div
class=
"container theme-showcase"
role=
"main"
>
<div
class=
"container theme-showcase"
role=
"main"
>
<h2>
My Graphs
</h2>
<h2>
My Graphs
</h2>
<ol>
<ol>
{% if coocs %}
{% for cooc in coocs %}
{% for cooc in coocs %}
<div
id=
"graph_{{cooc.id}}"
>
<div
id=
"graph_{{cooc.id}}"
>
<div
class=
"row"
>
<div
class=
"row"
>
...
@@ -27,18 +28,49 @@
...
@@ -27,18 +28,49 @@
<div
class=
"col-md-5 content"
>
<div
class=
"col-md-5 content"
>
<li>
<li>
<h4>
{{cooc.name}}
</h4>
<h4>
{{cooc.name}}
</h4>
{{cooc.date}}
{{cooc.date}}
<br>
{% for key, value in coocs_count.items %}
{% for key, value in coocs_count.items %}
{% if key == cooc.id %}
{% if key == cooc.id %}
{% if value > 0 %}
{% if value > 0 %}
From: {% if not cooc.hyperdata.parameters.start %} begin of corpus {% else %} {{cooc.hyperdata.parameters.start}} {% endif %}
, To: {% if not cooc.hyperdata.parameters.end %} end of corpus {% else %} {{cooc.hyperdata.parameters.end}} {% endif %}
<br>
<ul>
<ul>
<!-- <li>{{cooc.id}}</li> -->
<li>
<li>
From: {% if not cooc.hyperdata.start %} begin of corpus {% else %} {{cooc.hyperdata.start}} {% endif %}
<a
href=
"/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=conditional&bridgeness=5"
>
, To: {% if not cooc.hyperdata.end %} end of corpus {% else %} {{cooc.hyperdata.end}} {% endif %}
<span
class=
"glyphicon glyphicon-eye-open"
aria-hidden=
"true"
></span>
{% if cooc.hyperdata.conditional %}
~{{ cooc.hyperdata.conditional.nodes }} nodes,
~{{ cooc.hyperdata.conditional.edges }} edges
with
<b>
Conditional
</b>
distance
{% else %}
Compute this graph with Conditional distance
{% endif %}
</a>
</li>
<li>
<a
href=
"/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=distributional&bridgeness=5"
>
<span
class=
"glyphicon glyphicon-eye-open"
aria-hidden=
"true"
></span>
{% if cooc.hyperdata.distributional %}
~{{ cooc.hyperdata.distributional.nodes }} nodes,
~{{ cooc.hyperdata.distributional.edges }} edges
with
<b>
Distributional
</b>
distance
{% else %}
Compute this graph with Distributional distance
{% endif %}
</a>
</li>
</li>
<li>
~{{ value }} nodes with distances:
</ul>
<br>
<!-- <li>{{cooc.id}}</li>
<ul>
<ul>
<li>
<li>
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=conditional&bridgeness=5">
<a href="/projects/{{project.id}}/corpora/{{corpus.id}}/explorer?cooc_id={{cooc.id}}&distance=conditional&bridgeness=5">
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
<span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span>
...
@@ -62,7 +94,7 @@
...
@@ -62,7 +94,7 @@
)
)
</li>
</li>
</ul>
</ul>
</ul
>
--
>
{% else %}
{% else %}
<!--
<!--
...
@@ -115,6 +147,42 @@
...
@@ -115,6 +147,42 @@
</div>
</div>
{% endfor %}
{% endfor %}
{% else %}
<h3>
<span class="glyphicon glyphicon-flag" aria-hidden="true"></span>
You have not computed any graph already</h3>
<h4>
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
What is Graph ?
</h4>
<ul>
<li>Graph is a conveniant tool to explore your documents</li>
<li>Nodes are multi-terms selected in your Map List</li>
<li>Edges between nodes represent proximities of terms according to a specific distance between your documents.</li>
<ul>
<li>Conditional distance between the terms X and Y is the probability to have both terms X <b> and </b> Y in the same textual context.</li>
<li>Distributional distance between the terms X and Y is the probability to have same others terms in the same textual context as X <b>or</b> Y.</li>
</ul>
</ul>
<h4>
<span class="glyphicon glyphicon-hand-right" aria-hidden="true"></span>
How to compute a new graph ?
</h4>
<ol>
<li>Look at the menu</li>
<li>Click on Graphs</li>
<li>Choose a distance</li>
<li>Click on the distance or on MyGraph which is this page</li>
</ol>
<h4>
<span class="glyphicon glyphicon-ok-circle" aria-hidden="true"></span>
Do you want to test ?</h4>
</li>
<a href="/projects/{{project.id}}/corpora/{{ corpus.id }}/explorer?field1=ngrams&field2=ngrams&distance=conditional&bridgeness=5">Compute a new graph with conditional distance!</a>
{% endif %}
</ul>
</ul>
{% endblock %}
{% endblock %}
templates/pages/menu.html
View file @
983d5fb0
...
@@ -294,7 +294,7 @@
...
@@ -294,7 +294,7 @@
<p>
<p>
Gargantext
Gargantext
<span
class=
"glyphicon glyphicon-registration-mark"
aria-hidden=
"true"
></span>
<span
class=
"glyphicon glyphicon-registration-mark"
aria-hidden=
"true"
></span>
, version 3.0.5.
5
,
, version 3.0.5.
6
,
<a
href=
"http://www.cnrs.fr"
target=
"blank"
title=
"Institution that enables this project."
>
<a
href=
"http://www.cnrs.fr"
target=
"blank"
title=
"Institution that enables this project."
>
Copyrights
Copyrights
<span
class=
"glyphicon glyphicon-copyright-mark"
aria-hidden=
"true"
></span>
<span
class=
"glyphicon glyphicon-copyright-mark"
aria-hidden=
"true"
></span>
...
...
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