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
aa4605c0
Commit
aa4605c0
authored
Jun 18, 2015
by
PkSM3
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unstable' of
ssh://delanoe.org:1979/gargantext
into samuel
parents
67eb3782
9147e552
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
24 deletions
+17
-24
functions.py
analysis/functions.py
+10
-9
corpus_views.py
gargantext_web/corpus_views.py
+5
-1
menu.html
templates/corpus/menu.html
+2
-14
No files found.
analysis/functions.py
View file @
aa4605c0
...
@@ -221,8 +221,8 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', size=
...
@@ -221,8 +221,8 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', size=
n
=
n
.
sort
(
inplace
=
False
)
n
=
n
.
sort
(
inplace
=
False
)
m
=
m
.
sort
(
inplace
=
False
)
m
=
m
.
sort
(
inplace
=
False
)
print
(
n
)
#
print(n)
print
(
m
)
#
print(m)
nodes_included
=
300
#int(round(size/20,0))
nodes_included
=
300
#int(round(size/20,0))
#nodes_excluded = int(round(size/10,0))
#nodes_excluded = int(round(size/10,0))
...
@@ -247,25 +247,25 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', size=
...
@@ -247,25 +247,25 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', size=
xxx
=
xx
.
values
xxx
=
xx
.
values
threshold
=
min
(
xxx
.
max
(
axis
=
1
))
threshold
=
min
(
xxx
.
max
(
axis
=
1
))
matrix_filtered
=
np
.
where
(
xxx
>=
threshold
,
xxx
,
0
)
matrix_filtered
=
np
.
where
(
xxx
>=
threshold
,
xxx
,
0
)
#matrix_filtered = matrix_filtered.resize((90,90))
#matrix_filtered = matrix_filtered.resize((90,90))
except
:
except
:
PrintException
()
PrintException
()
try
:
try
:
G
=
nx
.
from_numpy_matrix
(
matrix_filtered
,
create_using
=
nx
.
MultiDiGraph
(
))
G
=
nx
.
from_numpy_matrix
(
np
.
matrix
(
matrix_filtered
))
G
=
nx
.
relabel_nodes
(
G
,
dict
(
enumerate
([
labels
[
label
]
for
label
in
list
(
xx
.
columns
)])
))
#G = nx.from_numpy_matrix(matrix_filtered, create_using=nx.MultiDiGraph(
))
#print(G
)
G
=
nx
.
relabel_nodes
(
G
,
dict
(
enumerate
([
labels
[
label
]
for
label
in
list
(
xx
.
columns
)]))
)
# Removing too connected nodes (find automatic way to do it)
# Removing too connected nodes (find automatic way to do it)
#edges_to_remove = [ e for e in G.edges_iter() if
#edges_to_remove = [ e for e in G.edges_iter() if
degree
=
G
.
degree
()
degree
=
G
.
degree
()
nodes_to_remove
=
[
n
for
n
in
degree
if
degree
[
n
]
<=
1
]
nodes_to_remove
=
[
n
for
n
in
degree
if
degree
[
n
]
<=
1
]
G
.
remove_nodes_from
(
nodes_to_remove
)
G
.
remove_nodes_from
(
nodes_to_remove
)
uG
=
G
.
to_undirected
()
partition
=
best_partition
(
G
)
partition
=
best_partition
(
u
G
)
except
:
except
:
print
(
"-"
*
30
)
PrintException
()
PrintException
()
...
@@ -281,7 +281,8 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', size=
...
@@ -281,7 +281,8 @@ def get_cooc(request=None, corpus_id=None, cooc_id=None, type='node_link', size=
G
.
node
[
node
][
'group'
]
=
partition
[
node
]
G
.
node
[
node
][
'group'
]
=
partition
[
node
]
# G.add_edge(node, "cluster " + str(partition[node]), weight=3)
# G.add_edge(node, "cluster " + str(partition[node]), weight=3)
except
Exception
as
error
:
except
Exception
as
error
:
print
(
"error01: "
,
error
)
pass
#PrintException()
#print("error01: ",error)
data
=
json_graph
.
node_link_data
(
G
)
data
=
json_graph
.
node_link_data
(
G
)
...
...
gargantext_web/corpus_views.py
View file @
aa4605c0
...
@@ -345,7 +345,11 @@ def test_ngrams(request , project_id, corpus_id ):
...
@@ -345,7 +345,11 @@ def test_ngrams(request , project_id, corpus_id ):
ngrams_ids
=
Ngrams_Scores
.
keys
()
ngrams_ids
=
Ngrams_Scores
.
keys
()
import
math
import
math
occs_threshold
=
min
(
10
,
math
.
sqrt
(
Sum
/
len
(
ngrams_ids
))
)
if
len
(
ngrams_ids
)
!=
0
:
occs_threshold
=
min
(
10
,
math
.
sqrt
(
Sum
/
len
(
ngrams_ids
))
)
else
:
occs_threshold
=
10
Metrics
=
{
Metrics
=
{
"ngrams"
:[],
"ngrams"
:[],
...
...
templates/corpus/menu.html
View file @
aa4605c0
...
@@ -80,7 +80,7 @@
...
@@ -80,7 +80,7 @@
<div class="container">
<div class="container">
<div class="row">
<div class="row">
<div class="col-md-
4
">
<div class="col-md-
6
">
<div class="jumbotron">
<div class="jumbotron">
<h3><a href="/project/{{project.id}}/corpus/{{corpus.id}}/chart">Advanced charts</a></h3>
<h3><a href="/project/{{project.id}}/corpus/{{corpus.id}}/chart">Advanced charts</a></h3>
<ol>
<ol>
...
@@ -92,20 +92,8 @@
...
@@ -92,20 +92,8 @@
</div>
</div>
</div>
</div>
<div
class=
"col-md-4"
>
<div
class=
"jumbotron"
>
<!-- <h3><a href="/project/{{project.id}}/corpus/{{corpus.id}}/matrix">Matrix</a></h3> -->
<h3>
Matrix (soon)
</h3>
<ol>
<li>
Sort
</li>
<li>
Group
</li>
<li>
Cluster
</li>
</ol>
<h4><a
href=
"/project/{{project.id}}/corpus/{{corpus.id}}/"
>
Back to corpus
</a></h3>
</div>
</div>
<div
class=
"col-md-
4
"
>
<div
class=
"col-md-
6
"
>
<div
class=
"jumbotron"
>
<div
class=
"jumbotron"
>
{% if processing > 0 %}
{% if processing > 0 %}
<h3>
<img
width=
"20px"
src=
"{% static "
js
/
libs
/
img2
/
loading-bar
.
gif
"
%}"
></img>
Graph (later)
</h3>
<h3>
<img
width=
"20px"
src=
"{% static "
js
/
libs
/
img2
/
loading-bar
.
gif
"
%}"
></img>
Graph (later)
</h3>
...
...
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