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
ab0aa5ba
Commit
ab0aa5ba
authored
Apr 04, 2016
by
delanoe
Browse files
Options
Browse Files
Download
Plain Diff
[FIX] merge conflicts.
parents
53f4d9b9
6d6ac234
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
151 additions
and
143 deletions
+151
-143
ngram_coocs.py
gargantext/util/toolchain/ngram_coocs.py
+4
-3
ngrams_extraction.py
gargantext/util/toolchain/ngrams_extraction.py
+3
-2
urls.py
gargantext/views/api/urls.py
+0
-1
terms.py
gargantext/views/pages/terms.py
+2
-2
views.py
graphExplorer/views.py
+7
-5
extras_explorerjs.js
static/js/extras_explorerjs.js
+111
-106
explorer.html
templates/graphExplorer/explorer.html
+24
-24
No files found.
gargantext/util/toolchain/ngram_coocs.py
View file @
ab0aa5ba
...
...
@@ -74,6 +74,7 @@ def compute_coocs( corpus,
"""
# - TODO add grouped element's values in grouping 'chief ngram'
# - TODO cvalue_id: allow a metric as additional input filter
# - TODO n_min, n_max : filter on Ngram.n (aka length of ngram)
# - TODO weighted: if False normal cooc to be saved as result
...
...
@@ -202,9 +203,9 @@ def compute_coocs( corpus,
matrix
=
WeightedMatrix
(
coocs_query
.
all
())
# fyi
#
shape_0 = len({pair[0] for pair in matrix.items})
#
shape_1 = len({pair[1] for pair in matrix.items})
#
print("COOCS: NEW matrix shape [%ix%i]" % (shape_0, shape_1))
shape_0
=
len
({
pair
[
0
]
for
pair
in
matrix
.
items
})
shape_1
=
len
({
pair
[
1
]
for
pair
in
matrix
.
items
})
print
(
"COOCS: NEW matrix shape [
%
ix
%
i]"
%
(
shape_0
,
shape_1
))
# 5) SAVE
# --------
...
...
gargantext/util/toolchain/ngrams_extraction.py
View file @
ab0aa5ba
...
...
@@ -64,8 +64,9 @@ def extract_ngrams(corpus, keys=('title', 'abstract', )):
for
ngram
in
ngramsextractor
.
extract
(
value
):
tokens
=
tuple
(
token
[
0
]
for
token
in
ngram
)
terms
=
normalize_terms
(
' '
.
join
(
tokens
))
nodes_ngrams_count
[(
document
.
id
,
terms
)]
+=
1
ngrams_data
.
add
((
terms
[:
255
],
len
(
tokens
),
))
if
len
(
terms
)
>
1
:
nodes_ngrams_count
[(
document
.
id
,
terms
)]
+=
1
ngrams_data
.
add
((
terms
[:
255
],
len
(
tokens
),
))
# integrate ngrams and nodes-ngrams
if
len
(
nodes_ngrams_count
)
>=
BATCH_NGRAMSEXTRACTION_SIZE
:
_integrate_associations
(
nodes_ngrams_count
,
ngrams_data
,
db
,
cursor
)
...
...
gargantext/views/api/urls.py
View file @
ab0aa5ba
...
...
@@ -24,5 +24,4 @@ urlpatterns = [
# - an optional grouplist)
url
(
r'^ngramlists/family$'
,
ngramlists
.
ListFamily
.
as_view
()),
]
gargantext/views/pages/terms.py
View file @
ab0aa5ba
...
...
@@ -11,7 +11,7 @@ def ngramtable(request, project_id, corpus_id):
=> maplist and mainlist terms in a table
with groupings as '+' nodes
=> uses API GET batch of lists
=> uses API PUT/DEL for list modifications
(TODO)
=> uses API PUT/DEL for list modifications
=> uses frontend AJAX through Ngrams_dyna_charts_and_table.js
# TODO refactor Ngrams_dyna_charts_and_table.js
'''
...
...
@@ -21,7 +21,7 @@ def ngramtable(request, project_id, corpus_id):
# and the project just for project.id in corpusBannerTop
project
=
cache
.
Node
[
project_id
]
# rendered page :
journal
s.html
# rendered page :
term
s.html
return
render
(
template_name
=
'pages/corpora/terms.html'
,
request
=
request
,
...
...
graphExplorer/views.py
View file @
ab0aa5ba
...
...
@@ -19,12 +19,15 @@ def explorer(request, project_id, corpus_id):
# we pass our corpus
corpus
=
cache
.
Node
[
corpus_id
]
# get the maplist_id for modifications
maplist_id
=
corpus
.
children
(
typename
=
"MAPLIST"
)
.
first
()
.
id
# and the project just for project.id in corpusBannerTop
project
=
cache
.
Node
[
project_id
]
graphurl
=
"projects/"
+
str
(
project_id
)
+
"/corpora/"
+
str
(
corpus_id
)
+
"/node_link.json"
# rendered page :
journals
.html
# rendered page :
explorer
.html
return
render
(
template_name
=
'graphExplorer/explorer.html'
,
request
=
request
,
...
...
@@ -35,9 +38,8 @@ def explorer(request, project_id, corpus_id):
'date'
:
datetime
.
now
(),
'project'
:
project
,
'corpus'
:
corpus
,
#'list_id' : maplist.id,\
'graphfile'
:
graphurl
,
\
'maplist_id'
:
maplist_id
,
'graphfile'
:
graphurl
,
'view'
:
'graph'
},
)
static/js/extras_explorerjs.js
View file @
ab0aa5ba
This diff is collapsed.
Click to expand it.
templates/graphExplorer/explorer.html
View file @
ab0aa5ba
...
...
@@ -18,7 +18,7 @@
}
#ctlzoom
{
width
:
7%
;
width
:
7%
;
}
#topPapers
{
...
...
@@ -36,7 +36,7 @@
#category0
ul
li
{
margin
:
0
12px
12px
0
;
}
#category1
ul
li
{
margin
:
0
12px
12px
0
;
}
</style>
<!--
<!--
<link rel="stylesheet" href="{% static "js/libs/bootswatch/css/bootswatch.css" %}">
<link rel="stylesheet" href="{% static "js/libs/css2/font.css" %}" type="text/css">
-->
...
...
@@ -101,10 +101,10 @@
<div
class=
"navbar-collapse collapse navbar-responsive-collapse"
>
<div
id=
"left"
style=
"margin:0em 2em;"
>
<ul
class=
"nav navbar-nav"
>
<!--
<!--
<li>
<a>
<a>
<select id="aselector" onchange="console.log('salut monde')" class="selectpicker" data-style="btn btn-success btn-sm" data-width="auto">
<option value="Document" selected>Scholars</option>
<option value="NGram">Keywords</option>
...
...
@@ -136,7 +136,7 @@
<li>
<a>
<div
id=
"graphid"
style=
"visibility: hidden;"
>
{{graphfile}}
</div>
<input
type=
"hidden"
id=
"
list_id"
value=
"{{
list_id }}"
></input>
<input
type=
"hidden"
id=
"
maplist_id"
value=
"{{ map
list_id }}"
></input>
<div
id=
"jquerytemplatenb"
style=
"visibility: hidden;"
>
{{user.id}}
</div>
</a>
</li>
...
...
@@ -148,10 +148,10 @@
</a>
</li>
-->
</ul>
<ul
id=
"category0"
class=
"nav navbar-nav navbar-right"
>
<li>
...
...
@@ -192,7 +192,7 @@
<input
id=
"searchinput"
autocomplete=
"off"
class=
"form-control input-sm col-lg-8"
placeholder=
"Search"
type=
"text"
>
</a></li>
</ul>
<ul
class=
"nav navbar-nav navbar-right"
>
<li>
<a>
...
...
@@ -226,7 +226,7 @@
</li>
</ul>
-->
</div>
<!-- /.nav-collapse -->
</div>
<!-- /.navbar -->
...
...
@@ -235,7 +235,7 @@
<div
id=
"zonecentre"
>
<!-- Page content -->
<div
id=
"sigma-example"
></div>
...
...
@@ -255,7 +255,7 @@
<img title="World Map Distribution" width="34px" src="{% static "js/libs/img2/world.png" %}" ></img>
</a>
</li>
-->
-->
<li>
...
...
@@ -263,13 +263,13 @@
<img
title=
"Take a photo!"
width=
"34px"
src=
"{% static "
js
/
libs
/
img2
/
camera
.
png
"
%}"
></img>
</a>
</li>
<li>
<a
href=
"#"
id=
"saveAs"
>
<img
width=
"30px"
title=
"Save As..."
src=
"{% static "
js
/
libs
/
img2
/
save
.
png
"
%}"
></img>
</a>
</li>
</li>
<li>
<a
href=
"#"
id=
"zoomPlusButton"
title=
"S'approcher"
>
</a>
</li>
...
...
@@ -294,12 +294,12 @@
</div>
<!-- Sidebar -->
<div
id=
"leftcolumn"
>
<div
id=
"leftcolumn"
>
<div
id=
"tips"
></div>
<div
id=
"names"
></div>
<div
id=
"ngrams_actions"
></div>
<br>
<div
id=
"tab-container"
class=
'tab-container'
style=
"display: none;"
>
...
...
@@ -320,7 +320,7 @@
</div>
<!-- <div id="topPapers"></div> -->
<div
id=
"tab-container-top"
class=
'tab-container'
style=
"display: none;"
>
<ul
class=
'etabs'
>
...
...
@@ -337,7 +337,7 @@
</div>
</div>
</div>
...
...
@@ -407,7 +407,7 @@
</div>
</div>
</div>
</div>
...
...
@@ -440,7 +440,7 @@
</div>
</div>
</div>
</div>
<div
id=
"modalloader"
class=
"modal fade"
>
...
...
@@ -457,15 +457,15 @@
<script
src=
"{% static "
js
/
libs
/
jquery
/
jquery
.
ba-dotimeout
.
min
.
js
"
%}"
type=
"text/javascript"
></script>
<script
src=
"{% static "
js
/
libs
/
jquery
/
jquery
.
mousewheel
.
min
.
js
"
%}"
type=
"text/javascript"
></script>
<script
type=
"text/javascript"
src=
"{% static "
js
/
libs
/
freshslider
.
1
.
0
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
js
/
libs
/
freshslider
.
1
.
0
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
js
/
libs
/
readmore
.
js
"
%}"
></script>
<script
type=
"text/javascript"
src=
"{% static "
js
/
libs
/
jquery
/
jquery
.
easytabs
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
libs
/
bootstrap
/
js
/
bootstrap
.
min
.
js
"
%}"
></script>
<script
src=
"{% static "
js
/
libs
/
bootstrap
/
js
/
bootstrap-modal
.
js
"
%}"
type=
"text/javascript"
></script>
<script
src=
"{% static "
js
/
libs
/
bootstrap
/
js
/
bootstrap-hover-dropdown
.
min
.
js
"
%}"
type=
"text/javascript"
></script>
<script
src=
"{% static "
js
/
tinawebJS
/
globalUtils
.
js
"
%}"
type=
"text/javascript"
></script>
<script
src=
"{% static "
js
/
tinawebJS
/
plugins
/
jLouvain
.
js
"
%}"
type=
"text/javascript"
></script>
...
...
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