2
0
This commit is contained in:
Cedric Hoelzl 2019-10-21 14:48:25 +02:00
parent 475a790b51
commit b99eb62498

View File

@ -72,6 +72,13 @@ function gen_kb(bot, p_en, parr,lang){
let bck = ""; let bck = "";
let kb = []; let kb = [];
let ntmr = tmr; let ntmr = tmr;
for(let k of Object.keys(ntmr)){
if(p_en.indexOf(k.toString()) == -1){
ntmr[k]=false;
continue;
}
}
for(let pp of parr){ for(let pp of parr){
try{ try{
if(ntmr[pp].sub){ if(ntmr[pp].sub){
@ -88,16 +95,13 @@ function gen_kb(bot, p_en, parr,lang){
} }
if(ntmr){ if(ntmr){
for(let k of Object.keys(ntmr)){ for(let k of Object.keys(ntmr)){
if(p_en.indexOf(k.toString()) == -1){
continue;
}
let ctmr = ntmr[k]; let ctmr = ntmr[k];
if(ctmr.sub){ if(ctmr.sub){
let str = ctmr.desc[lang]; let str = ctmr.desc[lang];
kb.push(bot.mkcb(str,cbt.sel,k)); kb.push(bot.mkcb(str,cbt.sel,k));
}else if(ctmr.tmr){ }else if(ctmr.tmr){
let str = ctmr.desc[lang]; let str = ctmr.desc[lang];
let c = arr.join("_") + "_" + k.toString(); let c = parr.join("_") + "_" + k.toString();
kb.push(bot.mkcb(str,cbt.sel,c)); kb.push(bot.mkcb(str,cbt.sel,c));
} }
@ -115,6 +119,10 @@ function gen_kb(bot, p_en, parr,lang){
return kb; return kb;
} }
// let bot ={
// mkcb:(x,y,z)=>{return y+"_"+z}
// }
// console.log(gen_kb(bot,["atrium"],["atrium"],0))
module.exports = function(arr){ module.exports = function(arr){
this.arr = arr; this.arr = arr;