Commit 03db9686 authored by delanoe's avatar delanoe

Merge branch 'samuel' into unstable

parents 8117fc8d 40723a01
......@@ -73,11 +73,14 @@ def test_page(request , project_id , corpus_id):
corpus = cache.Node[int(corpus_id)]
type_doc_id = cache.NodeType['Document'].id
number = session.query(func.count(Node.id)).filter(Node.parent_id==corpus_id, Node.type_id==type_doc_id).all()[0][0]
the_query = """ SELECT hyperdata FROM node_node WHERE id=%d """ % ( int(corpus_id) )
cursor = connection.cursor()
try:
processing = corpus.hyperdata['Processing']
except Exception as error:
print(error)
processing = 0
cursor.execute(the_query)
processing = cursor.fetchone()[0]["Processing"]
except:
processing = "Error"
html = t.render(Context({
'debug': settings.DEBUG,
......@@ -115,11 +118,13 @@ def get_ngrams(request , project_id , corpus_id ):
list_id = listIds(user_id=request.user.id, corpus_id=int(corpus_id), typeList=list_type)
lists["%s" % list_id[0][0]] = list_type
the_query = """ SELECT hyperdata FROM node_node WHERE id=%d """ % ( int(corpus_id) )
cursor = connection.cursor()
try:
processing = corpus.hyperdata['Processing']
except Exception as error:
print(error)
processing = 0
cursor.execute(the_query)
processing = cursor.fetchone()[0]["Processing"]
except:
processing = "Error"
html = t.render(Context({
'debug': settings.DEBUG,
......@@ -183,11 +188,13 @@ def get_journals(request , project_id , corpus_id ):
type_doc_id = cache.NodeType['Document'].id
number = session.query(func.count(Node.id)).filter(Node.parent_id==corpus_id, Node.type_id==type_doc_id).all()[0][0]
the_query = """ SELECT hyperdata FROM node_node WHERE id=%d """ % ( int(corpus_id) )
cursor = connection.cursor()
try:
processing = corpus.hyperdata['Processing']
except Exception as error:
print(error)
processing = 0
cursor.execute(the_query)
processing = cursor.fetchone()[0]["Processing"]
except:
processing = "Error"
html = t.render(Context({
'debug': settings.DEBUG,
......
......@@ -524,7 +524,7 @@ function SearchFilters( elem ) {
$.ajax({
url: '/tests/paginator/corpus/'+url_mainIDs["corpus"],
success: function(data){
$("#content_loader").remove()
for(var i in data.records) {
var orig_id = parseInt(data.records[i].id)
var arr_id = parseInt(i)
......
......@@ -502,6 +502,7 @@ $.ajax({
console.log(data)
$("#content_loader").remove()
// // Initializing the Charts and Table
var result = Main_test( data , "FirstScore" )
console.log( result )
......
......@@ -164,6 +164,7 @@ function GetUserPortfolio() {
}
});
}
function printCorpuses() {
console.log( "!!!!!!!! in printCorpuses() !!!!!!!! " )
pr(corpusesList)
......@@ -181,33 +182,53 @@ function printCorpuses() {
$("#closecorpuses").click();
// EXTERNAL CORPUS TO COMPARE:
var whichlist = $('input[name=whichlist]:checked').val()
var url = window.location.origin+"/api/node/"+selected_corpus+"/ngrams/list/"+whichlist+"?custom"
var url = window.location.origin+"/api/node/"+selected_corpus+"/ngrams/list/"+whichlist//+"?custom"
console.log( url )
GET_( url , function(results) {
if(Object.keys( results ).length>0) {
var sub_ngrams_data = {
"ngrams":[],
"scores": $.extend({}, NGrams["main"].scores)
}
if(whichlist=="stop") {
for(var r in results) {
var a_ngram = results[r]
a_ngram["state"] = System[0]["statesD"]["delete"]
sub_ngrams_data["ngrams"].push( a_ngram )
}
var result = Main_test(sub_ngrams_data , NGrams["main"].scores.initial , "filter_stop-list")
}
if(whichlist=="miam") {
for(var i in NGrams["main"].ngrams) {
var local_ngram = NGrams["main"].ngrams[i]
console.log( local_ngram )
}
var result = Main_test(sub_ngrams_data , NGrams["main"].scores.initial , "filter_all")
}
var sub_ngrams_data = {
"ngrams":[],
"scores": $.extend({}, NGrams["main"].scores)
}
for(var i in NGrams["main"].ngrams) {
if( results[ NGrams["main"].ngrams[i].id] ) {
var a_ngram = NGrams["main"].ngrams[i]
sub_ngrams_data["ngrams"].push( a_ngram )
}
// if( results[ NGrams["main"].ngrams[i].id] && NGrams["main"].ngrams[i].name.split(" ").length==1 ) {
// if( NGrams["map"][ NGrams["main"].ngrams[i].id] ) {
// var a_ngram = NGrams["main"].ngrams[i]
// // a_ngram["state"] = System[0]["statesD"]["delete"]
// sub_ngrams_data["ngrams"].push( a_ngram )
// }
// }
}
var result = Main_test(sub_ngrams_data , NGrams["main"].scores.initial , "filter_all")
// var sub_ngrams_data = {
// "ngrams":[],
// "scores": $.extend({}, NGrams["main"].scores)
// }
// if(whichlist=="stop") {
// for(var r in results) {
// var a_ngram = results[r]
// a_ngram["state"] = System[0]["statesD"]["delete"]
// sub_ngrams_data["ngrams"].push( a_ngram )
// }
// var result = Main_test(sub_ngrams_data , NGrams["main"].scores.initial , "filter_stop-list")
// }
// if(whichlist=="miam") {
// for(var i in NGrams["main"].ngrams) {
// var local_ngram = NGrams["main"].ngrams[i]
// console.log( local_ngram )
// }
// var result = Main_test(sub_ngrams_data , NGrams["main"].scores.initial , "filter_all")
// }
}
});
......@@ -928,7 +949,6 @@ function Main_test( data , initial , search_filter) {
}
function SearchFilters( elem ) {
var MODE = elem.value;
......
......@@ -222,7 +222,7 @@ input[type=radio]:checked + label {
<label class="control-label">
Which list do you want?</label>
<label class="radio">
<input value="miam" name="whichlist" disabled type="radio">MiamList
<input value="miam" name="whichlist" type="radio">MiamList
</label>
<label class="radio">
<input value="stop" name="whichlist" checked type="radio">StopList
......@@ -264,9 +264,9 @@ input[type=radio]:checked + label {
<option id="filter_stop-list" value="filter_stop-list">Stop-List</option>
<!-- </optgroup> -->
</select>
<!--
<button id="ImportList" onclick="GetUserPortfolio(); $('#corpuses').modal('show');" class="btn btn-warning">Import a Corpus-List</button>
-->
</div>
<script type="text/javascript" src="{% static "js/jquery/jquery.min.js" %}"></script>
......
......@@ -77,11 +77,14 @@ def get_ngrams(request , project_id , corpus_id ):
myamlist_type_id = cache.NodeType['MiamList'].id
miamlist = session.query(Node).filter(Node.user_id == request.user.id , Node.parent_id==corpus_id , Node.type_id == myamlist_type_id ).first()
t
the_query = """ SELECT hyperdata FROM node_node WHERE id=%d """ % ( int(corpus_id) )
cursor = connection.cursor()
try:
processing = corpus.hyperdata['Processing']
except Exception as error:
print(error)
processing = 0
cursor.execute(the_query)
processing = cursor.fetchone()[0]["Processing"]
except:
processing = "Error"
html = t.render(Context({
'debug': settings.DEBUG,
......@@ -116,11 +119,13 @@ def get_journals(request , project_id , corpus_id ):
type_doc_id = cache.NodeType['Document'].id
number = session.query(func.count(Node.id)).filter(Node.parent_id==corpus_id, Node.type_id==type_doc_id).all()[0][0]
the_query = """ SELECT hyperdata FROM node_node WHERE id=%d """ % ( int(corpus_id) )
cursor = connection.cursor()
try:
processing = corpus.hyperdata['Processing']
except Exception as error:
print(error)
processing = 0
cursor.execute(the_query)
processing = cursor.fetchone()[0]["Processing"]
except:
processing = "Error"
html = t.render(Context({
'debug': settings.DEBUG,
......
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