Commit ab0aa5ba authored by delanoe's avatar delanoe

[FIX] merge conflicts.

parents 53f4d9b9 6d6ac234
...@@ -74,6 +74,7 @@ def compute_coocs( corpus, ...@@ -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 cvalue_id: allow a metric as additional input filter
# - TODO n_min, n_max : filter on Ngram.n (aka length of ngram) # - TODO n_min, n_max : filter on Ngram.n (aka length of ngram)
# - TODO weighted: if False normal cooc to be saved as result # - TODO weighted: if False normal cooc to be saved as result
...@@ -202,9 +203,9 @@ def compute_coocs( corpus, ...@@ -202,9 +203,9 @@ def compute_coocs( corpus,
matrix = WeightedMatrix(coocs_query.all()) matrix = WeightedMatrix(coocs_query.all())
# fyi # fyi
# shape_0 = len({pair[0] for pair in matrix.items}) shape_0 = len({pair[0] for pair in matrix.items})
# shape_1 = len({pair[1] 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)) print("COOCS: NEW matrix shape [%ix%i]" % (shape_0, shape_1))
# 5) SAVE # 5) SAVE
# -------- # --------
......
...@@ -64,8 +64,9 @@ def extract_ngrams(corpus, keys=('title', 'abstract', )): ...@@ -64,8 +64,9 @@ def extract_ngrams(corpus, keys=('title', 'abstract', )):
for ngram in ngramsextractor.extract(value): for ngram in ngramsextractor.extract(value):
tokens = tuple(token[0] for token in ngram) tokens = tuple(token[0] for token in ngram)
terms = normalize_terms(' '.join(tokens)) terms = normalize_terms(' '.join(tokens))
nodes_ngrams_count[(document.id, terms)] += 1 if len(terms) > 1:
ngrams_data.add((terms[:255], len(tokens), )) nodes_ngrams_count[(document.id, terms)] += 1
ngrams_data.add((terms[:255], len(tokens), ))
# integrate ngrams and nodes-ngrams # integrate ngrams and nodes-ngrams
if len(nodes_ngrams_count) >= BATCH_NGRAMSEXTRACTION_SIZE: if len(nodes_ngrams_count) >= BATCH_NGRAMSEXTRACTION_SIZE:
_integrate_associations(nodes_ngrams_count, ngrams_data, db, cursor) _integrate_associations(nodes_ngrams_count, ngrams_data, db, cursor)
......
...@@ -24,5 +24,4 @@ urlpatterns = [ ...@@ -24,5 +24,4 @@ urlpatterns = [
# - an optional grouplist) # - an optional grouplist)
url(r'^ngramlists/family$', ngramlists.ListFamily.as_view()), url(r'^ngramlists/family$', ngramlists.ListFamily.as_view()),
] ]
...@@ -11,7 +11,7 @@ def ngramtable(request, project_id, corpus_id): ...@@ -11,7 +11,7 @@ def ngramtable(request, project_id, corpus_id):
=> maplist and mainlist terms in a table => maplist and mainlist terms in a table
with groupings as '+' nodes with groupings as '+' nodes
=> uses API GET batch of lists => 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 => uses frontend AJAX through Ngrams_dyna_charts_and_table.js
# TODO refactor 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): ...@@ -21,7 +21,7 @@ def ngramtable(request, project_id, corpus_id):
# and the project just for project.id in corpusBannerTop # and the project just for project.id in corpusBannerTop
project = cache.Node[project_id] project = cache.Node[project_id]
# rendered page : journals.html # rendered page : terms.html
return render( return render(
template_name = 'pages/corpora/terms.html', template_name = 'pages/corpora/terms.html',
request = request, request = request,
......
...@@ -19,12 +19,15 @@ def explorer(request, project_id, corpus_id): ...@@ -19,12 +19,15 @@ def explorer(request, project_id, corpus_id):
# we pass our corpus # we pass our corpus
corpus = cache.Node[corpus_id] 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 # and the project just for project.id in corpusBannerTop
project = cache.Node[project_id] project = cache.Node[project_id]
graphurl = "projects/" + str(project_id) + "/corpora/" + str(corpus_id) + "/node_link.json" graphurl = "projects/" + str(project_id) + "/corpora/" + str(corpus_id) + "/node_link.json"
# rendered page : journals.html # rendered page : explorer.html
return render( return render(
template_name = 'graphExplorer/explorer.html', template_name = 'graphExplorer/explorer.html',
request = request, request = request,
...@@ -35,9 +38,8 @@ def explorer(request, project_id, corpus_id): ...@@ -35,9 +38,8 @@ def explorer(request, project_id, corpus_id):
'date' : datetime.now(), 'date' : datetime.now(),
'project' : project, 'project' : project,
'corpus' : corpus, 'corpus' : corpus,
#'list_id' : maplist.id,\ 'maplist_id': maplist_id,
'graphfile' : graphurl,\ 'graphfile' : graphurl,
'view' : 'graph' 'view' : 'graph'
}, },
) )
This diff is collapsed.
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
} }
#ctlzoom { #ctlzoom {
width:7%; width:7%;
} }
#topPapers{ #topPapers{
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
#category0 ul li { margin: 0 12px 12px 0; } #category0 ul li { margin: 0 12px 12px 0; }
#category1 ul li { margin: 0 12px 12px 0; } #category1 ul li { margin: 0 12px 12px 0; }
</style> </style>
<!-- <!--
<link rel="stylesheet" href="{% static "js/libs/bootswatch/css/bootswatch.css" %}"> <link rel="stylesheet" href="{% static "js/libs/bootswatch/css/bootswatch.css" %}">
<link rel="stylesheet" href="{% static "js/libs/css2/font.css" %}" type="text/css"> <link rel="stylesheet" href="{% static "js/libs/css2/font.css" %}" type="text/css">
--> -->
...@@ -101,10 +101,10 @@ ...@@ -101,10 +101,10 @@
<div class="navbar-collapse collapse navbar-responsive-collapse"> <div class="navbar-collapse collapse navbar-responsive-collapse">
<div id="left" style="margin:0em 2em;"> <div id="left" style="margin:0em 2em;">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<!-- <!--
<li> <li>
<a> <a>
<select id="aselector" onchange="console.log('salut monde')" class="selectpicker" data-style="btn btn-success btn-sm" data-width="auto"> <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="Document" selected>Scholars</option>
<option value="NGram">Keywords</option> <option value="NGram">Keywords</option>
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
<li> <li>
<a> <a>
<div id="graphid" style="visibility: hidden;">{{graphfile}}</div> <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="{{ maplist_id }}"></input>
<div id="jquerytemplatenb" style="visibility: hidden;">{{user.id}}</div> <div id="jquerytemplatenb" style="visibility: hidden;">{{user.id}}</div>
</a> </a>
</li> </li>
...@@ -148,10 +148,10 @@ ...@@ -148,10 +148,10 @@
</a> </a>
</li> </li>
--> -->
</ul> </ul>
<ul id="category0" class="nav navbar-nav navbar-right"> <ul id="category0" class="nav navbar-nav navbar-right">
<li> <li>
...@@ -192,7 +192,7 @@ ...@@ -192,7 +192,7 @@
<input id="searchinput" autocomplete="off" class="form-control input-sm col-lg-8" placeholder="Search" type="text"> <input id="searchinput" autocomplete="off" class="form-control input-sm col-lg-8" placeholder="Search" type="text">
</a></li> </a></li>
</ul> </ul>
<ul class="nav navbar-nav navbar-right"> <ul class="nav navbar-nav navbar-right">
<li> <li>
<a> <a>
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
</li> </li>
</ul> </ul>
--> -->
</div><!-- /.nav-collapse --> </div><!-- /.nav-collapse -->
</div><!-- /.navbar --> </div><!-- /.navbar -->
...@@ -235,7 +235,7 @@ ...@@ -235,7 +235,7 @@
<div id="zonecentre"> <div id="zonecentre">
<!-- Page content --> <!-- Page content -->
<div id="sigma-example"></div> <div id="sigma-example"></div>
...@@ -255,7 +255,7 @@ ...@@ -255,7 +255,7 @@
<img title="World Map Distribution" width="34px" src="{% static "js/libs/img2/world.png" %}" ></img> <img title="World Map Distribution" width="34px" src="{% static "js/libs/img2/world.png" %}" ></img>
</a> </a>
</li> </li>
--> -->
<li> <li>
...@@ -263,13 +263,13 @@ ...@@ -263,13 +263,13 @@
<img title="Take a photo!" width="34px" src="{% static "js/libs/img2/camera.png" %}" ></img> <img title="Take a photo!" width="34px" src="{% static "js/libs/img2/camera.png" %}" ></img>
</a> </a>
</li> </li>
<li> <li>
<a href="#" id="saveAs"> <a href="#" id="saveAs">
<img width="30px" title="Save As..." src="{% static "js/libs/img2/save.png" %}" ></img> <img width="30px" title="Save As..." src="{% static "js/libs/img2/save.png" %}" ></img>
</a> </a>
</li> </li>
<li> <li>
<a href="#" id="zoomPlusButton" title="S'approcher"> </a> <a href="#" id="zoomPlusButton" title="S'approcher"> </a>
</li> </li>
...@@ -294,12 +294,12 @@ ...@@ -294,12 +294,12 @@
</div> </div>
<!-- Sidebar --> <!-- Sidebar -->
<div id="leftcolumn"> <div id="leftcolumn">
<div id="tips"></div> <div id="tips"></div>
<div id="names"></div> <div id="names"></div>
<div id="ngrams_actions"></div> <div id="ngrams_actions"></div>
<br> <br>
<div id="tab-container" class='tab-container' style="display: none;"> <div id="tab-container" class='tab-container' style="display: none;">
...@@ -320,7 +320,7 @@ ...@@ -320,7 +320,7 @@
</div> </div>
<!-- <div id="topPapers"></div> --> <!-- <div id="topPapers"></div> -->
<div id="tab-container-top" class='tab-container' style="display: none;"> <div id="tab-container-top" class='tab-container' style="display: none;">
<ul class='etabs'> <ul class='etabs'>
...@@ -337,7 +337,7 @@ ...@@ -337,7 +337,7 @@
</div> </div>
</div> </div>
</div> </div>
...@@ -407,7 +407,7 @@ ...@@ -407,7 +407,7 @@
</div> </div>
</div> </div>
</div> </div>
...@@ -440,7 +440,7 @@ ...@@ -440,7 +440,7 @@
</div> </div>
</div> </div>
</div> </div>
<div id="modalloader" class="modal fade"> <div id="modalloader" class="modal fade">
...@@ -457,15 +457,15 @@ ...@@ -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.ba-dotimeout.min.js" %}" type="text/javascript"></script>
<script src="{% static "js/libs/jquery/jquery.mousewheel.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/readmore.js" %}"></script>
<script type="text/javascript" src="{% static "js/libs/jquery/jquery.easytabs.min.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.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-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/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/globalUtils.js" %}" type="text/javascript"></script>
<script src="{% static "js/tinawebJS/plugins/jLouvain.js" %}" type="text/javascript"></script> <script src="{% static "js/tinawebJS/plugins/jLouvain.js" %}" type="text/javascript"></script>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment