Commit 043c82c9 authored by Romain Loth's avatar Romain Loth

show stopwords in term table

parent a540dfc5
...@@ -475,10 +475,12 @@ class ListFamily(APIView): ...@@ -475,10 +475,12 @@ class ListFamily(APIView):
hidden_ngrams_query = _query_grouped_ngrams(groups_id, details=True, hidden_ngrams_query = _query_grouped_ngrams(groups_id, details=True,
scoring_metric_id= scores_id) scoring_metric_id= scores_id)
# infos for stoplist terms, absent from mainlist
stop_ngrams_query = _query_list(other_list_ids['stoplist'], details=True,
scoring_metric_id=scores_id)
# and for the other lists (stop and map) # and for the other lists (stop and map)
# no details needed here, just the member ids # no details needed here, just the member ids
# - maplist ngrams will already be in ngraminfos b/c of mainlist
# - stoplist ngrams will not be shown in detail
for li in other_list_ids: for li in other_list_ids:
li_elts = _query_list(other_list_ids[li], details=False li_elts = _query_list(other_list_ids[li], details=False
).all() ).all()
...@@ -497,7 +499,7 @@ class ListFamily(APIView): ...@@ -497,7 +499,7 @@ class ListFamily(APIView):
# TODO add maplist membership # TODO add maplist membership
ngrams_which_need_detailed_info = mainlist_query.all() ngrams_which_need_detailed_info = mainlist_query.all()
else: else:
ngrams_which_need_detailed_info = mainlist_query.all() + hidden_ngrams_query.all() ngrams_which_need_detailed_info = mainlist_query.all() + hidden_ngrams_query.all() + stop_ngrams_query.all()
# the output form of details is: # the output form of details is:
# ngraminfo[id] => [term, weight] # ngraminfo[id] => [term, weight]
......
...@@ -1422,19 +1422,19 @@ function GROUPCRUD( groupnode_id , post_data , callback) { ...@@ -1422,19 +1422,19 @@ function GROUPCRUD( groupnode_id , post_data , callback) {
* 3. Creates the scores distribution chart over table * 3. Creates the scores distribution chart over table
* 4. Set up Search div * 4. Set up Search div
* *
* @param data: a response from the api/node/CID/ngrams/list/ routes * @param ngdata: a response from the api/node/CID/ngrams/list/ routes
* @param initial: initial score type "occs" or "tfidf" * @param initial: initial score type "occs" or "tfidf"
* @param search_filter: eg 'filter_all' (see SearchFilters.MODE) * @param search_filter: eg 'filter_all' (see SearchFilters.MODE)
*/ */
function MainTableAndCharts( data , initial , search_filter) { function MainTableAndCharts( ngdata , initial , search_filter) {
// debug // debug
// alert("refresh main") // alert("refresh main")
console.log("") console.log("")
console.log(" = = = = MainTableAndCharts: = = = = ") console.log(" = = = = MainTableAndCharts: = = = = ")
console.log("data:") console.log("ngdata:")
console.log(data) console.log(ngdata)
console.log("initial:") // console.log("initial:") //
console.log(initial) console.log(initial)
console.log("search_filter:") // eg 'filter_all' console.log("search_filter:") // eg 'filter_all'
...@@ -1442,13 +1442,13 @@ function MainTableAndCharts( data , initial , search_filter) { ...@@ -1442,13 +1442,13 @@ function MainTableAndCharts( data , initial , search_filter) {
console.log(" = = = = / MainTableAndCharts: = = = = ") console.log(" = = = = / MainTableAndCharts: = = = = ")
console.log("") console.log("")
// Expected infos in "data.ngrams" should have the form: // Expected infos in "ngdata.ngrams" should have the form:
// { "1": { id: "1", name: "réalité", score: 36 }, // { "1": { id: "1", name: "réalité", score: 36 },
// "9": { id: "9", name: "pdg", score: 116 }, // "9": { id: "9", name: "pdg", score: 116 },
// "10": { id:"10", name: "infrastructure", score: 12 } etc. } // "10": { id:"10", name: "infrastructure", score: 12 } etc. }
// (see filling of rec_info below) // (see filling of rec_info below)
// console.log(data.ngrams) // console.log(ngdata.ngrams)
var DistributionDict = {} var DistributionDict = {}
for(var i in DistributionDict) for(var i in DistributionDict)
...@@ -1530,8 +1530,8 @@ function MainTableAndCharts( data , initial , search_filter) { ...@@ -1530,8 +1530,8 @@ function MainTableAndCharts( data , initial , search_filter) {
$('#mapAll').data("columnSelection", 'SOME') $('#mapAll').data("columnSelection", 'SOME')
var div_stats = "<p>"; var div_stats = "<p>";
for(var i in data.scores) { for(var i in ngdata.scores) {
var value = (!isNaN(Number(data.scores[i])))? Number(data.scores[i]).toFixed(1) : data.scores[i]; var value = (!isNaN(Number(ngdata.scores[i])))? Number(ngdata.scores[i]).toFixed(1) : ngdata.scores[i];
div_stats += i+": "+value+" | " div_stats += i+": "+value+" | "
} }
div_stats += "</p>" div_stats += "</p>"
...@@ -1539,11 +1539,11 @@ function MainTableAndCharts( data , initial , search_filter) { ...@@ -1539,11 +1539,11 @@ function MainTableAndCharts( data , initial , search_filter) {
AjaxRecords = {} AjaxRecords = {}
for(var id in data.ngrams) { for(var id in ngdata.ngrams) {
// console.log(i) // console.log(i)
// console.log(data.ngrams[i]) // console.log(ngdata.ngrams[i])
var le_ngram = data.ngrams[id] ; var le_ngram = ngdata.ngrams[id] ;
// INIT records // INIT records
// one record <=> one line in the table + ngram states // one record <=> one line in the table + ngram states
...@@ -2011,13 +2011,20 @@ function AfterAjax() { ...@@ -2011,13 +2011,20 @@ function AfterAjax() {
// ----------------------------------------- MAPLIST // ----------------------------------------- MAPLIST
if( Object.keys(NGrams["map"]).length>0 ) { if( Object.keys(NGrams["map"]).length>0 ) {
for(var ngram_id in NGrams["main"].ngrams) { for(var ngram_id in NGrams["main"].ngrams) {
myMiamNgram = NGrams["main"].ngrams[ngram_id] myNgram = NGrams["main"].ngrams[ngram_id]
if(NGrams["map"][ngram_id]) { if(NGrams["map"][ngram_id]) {
// keepstateId = 1 // keepstateId = 1
keepstateId = System[0]["statesD"]["keep"] keepstateId = System[0]["statesD"]["keep"]
// initialize state of maplist items // initialize state of maplist items
myMiamNgram["state"] = keepstateId ; myNgram["state"] = keepstateId ;
}
else if (NGrams["stop"][ngram_id]) {
// delstateId = 2
delstateId = System[0]["statesD"]["delete"]
// initialize state of stoplist items
myNgram["state"] = delstateId ;
} }
} }
} }
......
...@@ -67,14 +67,13 @@ ...@@ -67,14 +67,13 @@
<option value='0'>Candidates only</option> <option value='0'>Candidates only</option>
<!-- <option value='1' selected="selected">Map terms only</option> --> <!-- <option value='1' selected="selected">Map terms only</option> -->
<option value='1'>Map terms only</option> <option value='1'>Map terms only</option>
<option value='2'>New stopwords only</option> <option value='2'>Stopwords only</option>
</select> </select>
</div> </div>
</h4> </h4>
</div> </div>
<div id="terms_table" class="panel-body"> <div id="terms_table" class="panel-body">
<div id="div-table"> <div id="div-table">
<!-- (table id="my-ajax-table") dynamically set by Ngrams_dyna_chart_and_table --> <!-- (table id="my-ajax-table") dynamically set by Ngrams_dyna_chart_and_table -->
......
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