Commit 37ad3d64 authored by delanoe's avatar delanoe

Merge remote-tracking branch 'origin/romain-testing' into testing-merge

parents 4121cf5e 4f0f9e7d
......@@ -462,6 +462,9 @@ def import_ngramlists(fname, delimiter=DEFAULT_CSV_DELIM,
for j, colname in enumerate(csv_row):
if colname in ['label', 'status', 'forms']:
columns[colname] = j
# skip empty columns
elif match(r'^\s*$',colname):
pass
else:
raise ValueError('Wrong header "%s" on line %i (only possible headers are "label", "forms" and "status")' % (colname, n_read_lines))
if 'label' not in columns:
......@@ -548,7 +551,9 @@ def import_ngramlists(fname, delimiter=DEFAULT_CSV_DELIM,
imported_ngrams_dbdata.append((ngram_str, n_words))
# returns a dict {term => id} and a count of inserted ones
# -------------------------
(new_ngrams_ids, n_added_ng) = bulk_insert_ifnotexists(
# -------------------------
model = Ngram,
uniquekey = 'terms',
fields = ('terms', 'n'),
......@@ -612,7 +617,7 @@ def merge_ngramlists(new_lists={}, onto_corpus=None, del_originals=[]):
- resolves conflicts if terms belong in different lists
> map wins over both other types
> main wins over stop
> stop never wins
> stop never wins £TODO STOP wins over candidates from main
@param new_lists: a dict of *new* imported lists with format:
{'stop': UnweightedList,
......@@ -667,7 +672,10 @@ def merge_ngramlists(new_lists={}, onto_corpus=None, del_originals=[]):
for ng_id in new_lists[list_type].items:
collect(ng_id)
from gargantext.util.toolchain.main import t
print("MERGE DEBUG: starting index_new_ngrams", t())
n_added = index_new_ngrams(all_possibly_new_ngram_ids, onto_corpus)
print("MERGE DEBUG: finished index_new_ngrams", t())
my_log.append("MERGE: added %i new ngram occurrences in docs" % n_added)
......@@ -677,7 +685,7 @@ def merge_ngramlists(new_lists={}, onto_corpus=None, del_originals=[]):
# DB nodes stored with same indices 0,1,2 (resp. stop, miam and map)
# find target ids of the list node objects
tgt_nodeids = [
onto_corpus.children("STOPLIST").first().id,
onto_corpus.children("STOPLIST").first().id, # £todo via parent project?
onto_corpus.children("MAINLIST").first().id,
onto_corpus.children("MAPLIST").first().id
]
......
......@@ -89,10 +89,10 @@ function CRUD( list_id , ngram_ids , http_method , callback) {
// general listener: shift key in the window <=> add to selection
$(document).on('keyup keydown', function(e){
// changes the global boolean ("add node to selection" status) if keydown and SHIFT
checkBox = e.shiftKey
checkBox = manuallyChecked || e.shiftKey
// show it in the real checkbox too
$('#checkboxdiv').prop("checked", e.shiftKey)
$('#checkboxdiv').prop("checked", manuallyChecked || e.shiftKey)
} );
// = = = = = = = = = = = [ Clusters Plugin ] = = = = = = = = = = = //
......
......@@ -169,6 +169,7 @@ var gexf;
//var zoom=0;
var checkBox=false;
var manuallyChecked = false;
var overNodes=false;
var shift_key=false;
......
......@@ -79,7 +79,13 @@ function highlightSelectedNodes(flag){
function alertCheckBox(eventCheck){
// console.log('FUN t.methods:alertCheckBox')
if(!isUndef(eventCheck.checked)) checkBox=eventCheck.checked;
// NB: we use 2 booleans to adapt to SHIFT checking
// - var checkBox ---------> has the real box state
// - var manuallyChecked --> remembers if it was changed here
if(!isUndef(eventCheck.checked)) {
checkBox=eventCheck.checked;
manuallyChecked = eventCheck.checked
}
}
// States:
......
......@@ -58,7 +58,7 @@
<!-- this is the tweakbar -->
<div class="container-fluid navbar-default">
<div id="defaultop" class="row">
<div id="left" class="col-sm-10 col-md-10 col-lg-7">
<div id="left" class="col-sm-8 col-md-8 col-lg-7">
<ul class="nav navbar-nav">
<!--
......@@ -75,9 +75,9 @@
<button type="button" id="changetype" class="btn btn-success btn-sm">Change Type</button>
</a></li>
<li class='basicitem'><a>
<!-- <li class='basicitem'><a>
<button type="button" id="changelevel" class="btn btn-info btn-sm" disabled>Change Level</button>
</a></li>
</a></li> -->
<!-- TODO fix: category0 -> category1 switching -->
<li class='basicitem'><a>
......@@ -88,10 +88,10 @@
</ul>
</a></li>
<li class='basicitem'><a>
<!-- <li class='basicitem'><a>
Compare<br>
<img width="30" title="Compare with other corpus!" onclick="GetUserPortfolio(); $('#corpuses').modal('show');" src="{% static "img/INTER.png" %}"></img>
</a></li>
</a></li> -->
<li class='basicitem'><a>
<!-- TODO fix: category0 -> category1 switching -->
......@@ -124,7 +124,7 @@
</ul>
</div><!-- /div#left -->
<div id="right" class="col-sm-1 col-md-1 col-lg-4">
<div id="right" class="col-sm-3 col-md-3 col-lg-4">
<div class='row' id="searchnav">
<div class="col-sm-1 col-md-1 col-lg-1" style="font-size:75%; line-height:90%; padding:0">
......
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