Skip to content

Commit

Permalink
change save cat
Browse files Browse the repository at this point in the history
  • Loading branch information
Ltochon committed May 6, 2022
1 parent 8af65db commit 7c7e4e6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
14 changes: 7 additions & 7 deletions K-AnoTool/generalization/templates/generalization.html
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,9 @@
if(localStorage.getItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",'')) != null){
tabname = [];
let w2 = 0;
let arr = localStorage.getItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",'')).split("|").at(-1).split("<br>");
while(w2 < arr.length -1){
tabname.push(arr[w2].split("'")[1])
let arr = localStorage.getItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",'')).split("|").at(-1).split("},{");
while(w2 < arr.length){
tabname.push(arr[w2].split('"')[1])
w2++;
}
if(tabname.length === 1){
Expand All @@ -401,7 +401,7 @@
}
for(w in tabname){
let p = document.createElement("p");
p.innerHTML = tabname[w];
p.innerHTML = '"' + tabname[w] + '"';
p.style.marginBottom = "2px";
if(localStorage.getItem("type_" + localStorage.getItem("qid").replace("hiera_",'')) === "cat"){
document.getElementById("printlaw").hidden = false;
Expand Down Expand Up @@ -495,10 +495,10 @@
}
if(okcat) {
if(localStorage.getItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",'')) === null){
localStorage.setItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",''),document.getElementById("printlaw").innerHTML)
localStorage.setItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",''),'{' + document.getElementById("printlaw").innerHTML.replaceAll("<br>",'},{').replaceAll("'",'"').slice(0, -2))
}
else{
localStorage.setItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",''),localStorage.getItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",'')) + "|" + document.getElementById("printlaw").innerHTML)
localStorage.setItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",''),localStorage.getItem("diccategories_" + localStorage.getItem("qid").replace("hiera_",'')) + "|" + '{' + document.getElementById("printlaw").innerHTML.replaceAll("<br>",'},{').replaceAll("'",'"').slice(0, -2))
}
let line = document.getElementById("printlaw").innerHTML.split("<br>");
let l = 0;
Expand Down Expand Up @@ -779,7 +779,7 @@ <h6 id="txtnew" style="font-weight: bold; margin-top: 3px;"></h6>
}
for(elem in dictotal[qid]){
let p = document.createElement("p");
p.innerHTML = dictotal[qid][elem];
p.innerHTML = '"' + dictotal[qid][elem] + '"';
p.style.marginBottom = "2px";
if(localStorage.getItem("type_" + localStorage.getItem("qid").replace("hiera_",'')) === "cat"){
p.style.cursor = "pointer";
Expand Down
Binary file modified K-AnoTool/result/__pycache__/result.cpython-39.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions K-AnoTool/result/result.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ def result_page():
if(isinstance(types, str)):
types = (types,)
#print(types,sys.stderr)
#print(tab_depth,sys.stderr)
#print(tab_lattice,sys.stderr)
#print(tab_weight,sys.stderr)
compute_ano = algo_web(data,qid_str,tab_depth,tab_weight,k,max_supp,types,tab_lattice)
list_cost = []
for i in compute_ano:
Expand Down
Binary file modified test_algo/__pycache__/ssw_web.cpython-39.pyc
Binary file not shown.
3 changes: 2 additions & 1 deletion test_algo/ssw_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ def generalize(df,qid,lvl,type_inp,lattice,max_gen):
while(i < len(df)): #foreach value
df.at[i,qid] = '*'
i += 1
elif type_inp == 'cat':
rule = json.loads("[[{" + str(lattice.replace("|","],["))[7:len(str(lattice.split("|")))]+ "]]")
return df

def occu(df,qid):
Expand All @@ -71,7 +73,6 @@ def occu(df,qid):

def algo_web(df_init,qid,max_gen,weigths,k,max_supp,types,lattice):
list_comb = create_lattice(max_gen)
print(list_comb)
list_cost = []
current_level = [round(len(list_comb)/2)] #start of binary search
stop = False
Expand Down

0 comments on commit 7c7e4e6

Please sign in to comment.