Begin met de bouw van een conversatie
Semanta Tel:+31-162-313323 of International +1-514-331-0572
";
$userip=$_SERVER['REMOTE_ADDR'];
$datm=date("Y-m-d H:i:s", time());
// echo "
".$datm;
$datm_dtls=explode(" ",$datm);
$datm_datm=$datm_dtls[0];
$datm_time=$datm_dtls[1];
// print_r($datm_dtls);
require_once("xtrt-aiml-func.php");
include ("config.php");
include ("conv.php");
require_once("xtrt-xxxx-func.php");
require_once("chbt-date-func.php");
/////////////
echo "
TEKSTVERWERKING";
echo "";
$json_itms=explode("@",$invr_bzv1);
print_r($json_itms);
$json_aiml=$json_itms[0];
$json_lnks=$json_itms[1];
$json_rchs=$json_itms[2];
$json_tpic=str_replace(" ","_",$json_itms[3]);
echo "
FUNC".$invr_func." BZKR ".$invr_bzkr." CHBT ".$invr_chbt."CORP ".$invr_corp." TAAL ".$invr_taal." BZV1 ".$invr_bzv1." BZV2 ".$invr_bzv2." PERC ".$json_perc." RCHS ".$json_rchs." LNKS ".$json_lnks." TPIC ".$json_tpic." SESS ".$invr_sess;
// echo "
De conversie is bedoeld voor ".$invr_func;
echo "
";
foreach($json_itms as $json_key => $json_val)
{
echo " ".$json_val."";
}
////////////////////////
$qstn_rslt=xtrt_aiml($invr_bzv1,"äiml");
// print_r($qstn_rslt);
$file_name="./json/".$datm."_".$json_aiml.".txt";
$file_name=str_replace(" ","_",$file_name);
// echo "
FILE NAME".$file_name;
$fq = fopen($file_name, 'w');
foreach($qstn_rslt as $aiml_key => $aiml_val)
{
// echo "
AIML KEY ".$aiml_key;
$aiml_itms=explode("@",$aiml_key);
// print_r($aiml_itms);
// echo "
".$aiml_key."AIML VAL ".$aiml_val;
$aiml_ptrn=$aiml_itms[1];
$aiml_tmpl=$aiml_itms[2];
$aiml_aiml=$aiml_itms[3];
if ($aiml_aiml == null)
{
$aiml_aiml="semanta";
}
$aiml_data=$aiml_key;
$json_tpic=trim($json_tpic);
$aiml_rslt=$aiml_aiml."!!".$aiml_ptrn."!!".$aiml_tmpl;
echo "".$aiml_aiml." | ".$aiml_ptrn." | ".$aiml_tmpl." |
";
echo "
AIML RSLT ".$aiml_rslt;
fwrite($fq,$aiml_rslt."\r\n");
}
fclose($fq);
echo "
";
echo "
Bekijk het resultaat voor het TEXT bestand";
//////////////////////////////
echo "
PANDORA VERWERKING";
$file_name="./json/".$datm."_".$json_tpic.".aiml";
$file_name=str_replace(" ","_",$file_name);
// echo "
FILE NAME".$file_name;
$fq = fopen($file_name, 'w');
$aiml_hdr1='';
$aiml_hdr2='';
fwrite($fq,$aiml_hdr1);
fwrite($fq,$aiml_hdr2."\r\n");
$aiml_fter="";
echo "
Bekijk het resultaat voor Pandora ";
echo "";
echo "Onderwerp | pattern | template |
";
foreach($qstn_rslt as $aiml_key => $aiml_val)
{
// echo "
AIML KEY ".$aiml_key;
$aiml_itms=explode("@",$aiml_key);
// print_r($aiml_itms);
// echo "
".$aiml_key."AIML VAL ".$aiml_val;
$aiml_ptrn=$aiml_itms[1];
$aiml_tmpl=$aiml_itms[2];
$aiml_aiml=$aiml_itms[3];
if ($aiml_aiml == null)
{
$aiml_aiml="Pandora";
}
// $aiml_data=$aiml_key;
$json_tpic=trim($json_tpic);
echo "".$aiml_aiml." | ".$aiml_ptrn." | ".$aiml_tmpl." |
";
$aiml_rslt=$aiml_aiml."!!".$aiml_ptrn."!!".$aim_tmpl;
fwrite($fq,$aiml_rslt."\r\n");
}
echo "
";
fwrite($fq,$aiml_fter);
fclose($fq);
echo "
Bekijk het resultaat voor het AIML bestand";
//////////////////////////////
echo "
WATERMELON VERWERKING";
$file_name="./json/watermelon/".$datm."_".$json_tpic.".aiml";
$file_name=str_replace(" ","_",$file_name);
echo "
FILE NAME".$file_name;
$fq = fopen($file_name, 'w');
echo "
Bekijk het resultaat voor Watermelon ";
echo "";
echo "Onderwerp | vraag | antwoord |
";
foreach($qstn_rslt as $aiml_key => $aiml_val)
{
// echo "
AIML KEY ".$aiml_key;
$aiml_itms=explode("@",$aiml_key);
// print_r($aiml_itms);
// echo "
".$aiml_key."AIML VAL ".$aiml_val;
$aiml_ptrn=$aiml_itms[1];
$aiml_tmpl=$aiml_itms[2];
$aiml_aiml=$aiml_itms[3];
if ($aiml_aiml == null)
{
$aiml_aiml="Watermelon";
}
// $aiml_data=$aiml_key;
$json_tpic=trim($json_tpic);
echo "".$aiml_aiml." | ".$aiml_ptrn." | ".$aiml_tmpl." |
";
$aiml_rslt=$aiml_aiml."!!".$aiml_ptrn."!!".$aim_tmpl;
fwrite($fq,$aiml_rslt."\r\n");
}
echo "
";
fclose($fq);
// echo "
Bekijk het resultaat voor het AIML bestand";
/////////////// WATSON ////
echo "
WATSON VERWERKING ";
echo "";
echo "Topic | Intent | Text |
";
$file_name="./json/watson/".$datm."_".$json_aiml.".txt";
$file_name=str_replace(" ","_",$file_name);
// echo "
FILE NAME".$file_name;
$fq = fopen($file_name, 'w');
if ($invr_chbt== null)
{
$invr_chbt= "semantus";
}
$aiml_hdr1="name,".$invr_chbt;
$aiml_hdr2="created,".$datm;
$aiml_hdr3="intents";
// echo "
AIML WTSN ".$aiml_hdr3;
fwrite($fq,$aiml_hdr1."\r\n");
fwrite($fq,$aiml_hdr2."\r\n");
fwrite($fq,$aiml_hdr3."\r\n");
$aiml_fter="action,end_conversation\n";
$sqltref="SELECT * FROM conversation_log order by `input` desc limit 20";
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");
$trefresult = mysql_query($sqltref, $link);
$tref_num = mysql_num_rows($trefresult);
$lr=$tref_num-4;
$nr=0;
// echo "
Aantallen WATSON ".$sqltref." ".$tref_num." AFDRUKKEN ".$lr;
while ($row = mysql_fetch_assoc($trefresult))
{
$bot_nr=$row['bot_id'];
$aiml=$row['aiml'];
$pattern=$row['input'];
$template=$row['response'];
// echo "
PATTERN ".$pattern." TEMPLATE ".urlencode($template);
if ($template != "geen valide antwoord" )
{
// echo "
geldige antwoorden";
if ($prelt != $pattern.$template)
{
$aiml_ptrn="intent,".$pattern;
$aiml_tmpl="text,".$template;
echo "".$aiml_aiml." | ".$aiml_ptrn." | ".$aiml_tmpl." |
";
if ($aiml_aiml == null)
{
$aiml_aiml="Watson";
}
// $aiml_data=$aiml_key;
$aiml_rslt=$aiml_aiml.",".$aiml_ptrn.$aim_tmpl;
fwrite($fq,$aiml_rslt."\r\n");
$prelt=$pattern.$template;
}
}
$json_tpic=trim($json_tpic);
}
foreach($qstn_rslt as $aiml_key => $aiml_val)
{
// echo "
AIML KEY ".$aiml_key;
$aiml_itms=explode("@",$aiml_key);
// print_r($aiml_itms);
// echo "
".$aiml_key."AIML VAL ".$aiml_val;
$aiml_ptrn=$aiml_itms[1];
$aiml_tmpl=$aiml_itms[2];
$aiml_aiml=$aiml_itms[3];
if ($aiml_ptrn != "geen valide antwoord" )
{
// $aiml_data=$aiml_key;
$json_tpic=trim($json_tpic);
$aiml_ptrn="intent,".$aiml_ptrn;
fwrite($fq,$aiml_ptrn."\r\n");
$aiml_tmpl="text,".$aiml_tmpl;
// echo "
".$aiml_ptrn." ".$aiml_tmpl;
fwrite($fq,$aiml_tmpl."\r\n");
if ($aiml_aiml == null)
{
$aiml_aiml="Watson";
}
echo "".$aiml_aiml." | ".$aiml_ptrn." | ".$aiml_tmpl." |
";
fwrite($fq,$aiml_rslt."\r\n");
}
}
fwrite($fq,$aiml_fter);
fclose($fq);
echo "
";
echo "
Bekijk het resultaat voor het WATSON bestand";
////////////////
////////////////////// ALDEBERAN ROBOTS VERWERKING //////////////
echo "
ALDEBERAN ROBOTS VERWERKING ";
echo "";
// echo "Concept | Proposal | U: tekst |
";
$file_name="./json/aldebaran/".$datm."_".$json_aiml.".txt";
$file_name=str_replace(" ","_",$file_name);
echo "
FILE NAME".$file_name;
$fq = fopen($file_name, 'w');
if ($invr_chbt== null)
{
$invr_chbt= "semantus";
}
$lgroet=chbt_date("IT@1@2@".$invr_taal."@".$invr_bzkr);
$curr_jaar=$lgroet[jaar];
// print_r($lgroet);
////////////
//////////////
$site_datm=date("Y-m-d H:i:s", time());
$datm_itms=explode(" ",$site_datm);
$datm_datm=$datm_itms[0];
$datm_time=$datm_itms[1];
$zoek_datm="%".substr($datm_datm,5,5)."%";
// echo "
VOORAF INVR SESS ".$invr_sess." INVR BZV1 ".$invr_bzv1." INVR CORP ".$invr_corp." INVR LNKS ".$invr_lnks." INVR TAAL ".$invr_taal." INVR CHBT ".$invr_chbt." INVR RCHS ".$invr_rchs."INVR BZV2 ".$invr_bzv2."INVR DOMN".$invr_domn." INVR LGRM ".$invr_lgrm;
// echo "
DATUM ".$datm_datm."ZOEK DATM ".$zoek_datm;
$cmds_ipad=$invr_sess."!!".$invr_bzv1;
// echo "
CMDS IPAD ".$cmds_ipad." AIML LNKS ".$aiml_lnks." AIML BIND ".$aiml_bind." AIML RCHS ".$aiml_rchs;
// $cmds_bzv2=$text_file."[splt[".$invr_taal."[".$invr_corp."[".$full_val."[1";
$cmds_bzv2=$invr_lnks."[rule[".$invr_taal."[".$invr_domn."!!".$invr_corp."[".$invr_rchs."[100";
echo "
SPLT INVR BZV2 ".$cmds_bzv2."
";
// include ("chbt-cmds-code-2.php");
///////////////////// EERSTE INDRUK /////////////////////////
////////////////////// Conversations ////////////////////
if ($invr_chbt== null)
{
$invr_chbt= "semantus";
}
$nr=0;
// echo "
FILE NAME".$file_name;
if ($invr_chbt== null)
{
$invr_chbt= "semantus";
}
$sqltref="SELECT * FROM conversation_log order by `input` desc limit 20";
mysql_query("SET CHARACTER SET utf8");
mysql_query("SET NAMES utf8");
$trefresult = mysql_query($sqltref, $link);
$tref_num = mysql_num_rows($trefresult);
$lr=$tref_num-4;
$nr=0;
// echo "
Aantallen ".$sqltref." ".$tref_num." LIMIT ALDEBERAN ".$lr;
while ($row = mysql_fetch_assoc($trefresult))
{
$bot_nr=$row['bot_id'];
$aiml=$row['aiml'];
$pattern=$row['input'];
$template=$row['response'];
// echo "
PATTERN ".$pattern." TEMPLATE ".urlencode($template);
if ($template != "geen valide antwoord" )
{
// echo "
geldige antwoorden";
if ($prelt != $pattern.$template)
{
// concept:(bzv1) [pesach kimpoer kerstmis kerst pasen pinksteren hemelvaart suikerfeest ramadan feestje "wat te vieren" "5 mei" carnaval dies jubileum luilak lustrum millennium onafhankelijkheid oudejaar oud-en-nieuw verjaardag]
$chbt_aiml="concept:(".$aiml_tpic.") [".$pattern."]";
fwrite($fq,$chbt_aiml."\r\n");
echo "
";
// proposal: %leraar maak een praatje met leraar over $1 in het corpus infonu
$chbt_aiml="proposal:%".$aiml_tpic." ".$template;
fwrite($fq,$chbt_aiml."\r\n");
echo "
";
// u:(~bzv1) waar is de viering
$chbt_aiml="U:(~".$aiml_tpic.") ".$pattern;
fwrite($fq,$chbt_aiml."\r\n");
echo "
";
$prelt=$pattern.$template;
}
}
}
/////////////////////////////////////////////////////////////////
$aiml_rslt = xtrt_aiml($invr_bzv1,$invr_taal);
if ($invr_bzv1 != null )
{
// echo "
INVR CONT INVR SESS ".$invr_sess." INVR BZV1 ".$invr_bzv1." INVR CORP ".$invr_corp." INVR CONT ".$invr_cont." INVR TAAL ".$invr_taal." INVR CHBT ".$invr_chbt." INVR MAIL ".$invr_mail."INVR BZV2 ".$invr_bzv2."INVR DOMN".$invr_domn." INVR LGRM ".$invr_lgrm;
$na=0;
// krsort($aiml_rslt);
// print_r($aiml_rslt);
// echo "";
// echo "Topic Interpretatie | Reactie |
";
foreach($aiml_rslt as $aiml_key => $aiml_val)
{
$key_dtls=explode("@",$aiml_key);
$aiml_tpic=$key_dtls[0];
$aiml_utng=$key_dtls[1];
$aiml_rctie=$key_dtls[2];
// echo "
".$aiml_rctie."";
$dspl_antw=$aiml_rctie;
$pos = strpos($aiml_resp, "*");
if ($pos === false)
{
// echo "
".$aiml_resp."";
if ($na < 2)
{
$dspl_antw=str_replace("seeker",$invr_name,$dspl_antw);
$dspl_antw=str_replace("xxxx","web master",$dspl_antw);
$dspl_antw=str_replace("gesprekspartner",$invr_chbt,$dspl_antw);
$dspl_antw=str_replace("invrvrag",$say,$dspl_antw);
$dspl_antw=str_replace("invrmin1",$invr_min1,$dspl_antw);
$dspl_antw=str_replace("invrdatm",$datm_datm,$dspl_antw);
$dspl_antw=str_replace("invrjaar",$datm_jaar,$dspl_antw);
$dspl_antw=str_replace("invrmand",$datm_mand,$dspl_antw);
$dspl_antw=str_replace("invrtime",$datm_time,$dspl_antw);
$dspl_antw=str_replace("invrwkdg",$weekdag,$dspl_antw);
$dspl_antw=str_replace("invrcorp",$invr_corp,$dspl_antw);
$dspl_antw=str_replace("invrchbt",$invr_chbt,$dspl_antw);
$dspl_antw=str_replace("invrbzkr",$invr_bzkr,$dspl_antw);
$dspl_antw=str_replace("invrname",$invr_name,$dspl_antw);
$dspl_antw=str_replace("invrbzv1",$invr_bzv1,$dspl_antw);
$dspl_antw=str_replace("invrbzv2",$invr_bzv2,$dspl_antw);
$dspl_antw=str_replace("invrsmdm",$invr_smdm,$dspl_antw);
$dspl_antw=str_replace("invrcont",$invr_cont,$dspl_antw);
$dspl_antw=str_replace("invrhttp",$invr_ipad,$dspl_antw);
$dspl_antw=str_replace("invripad",$invr_ipad,$dspl_antw);
$aiml_rctie=$dspl_antw;
$chbt_aiml="concept:(".$aiml_tpic.") [".$pattern."]";
fwrite($fq,$chbt_aiml."\r\n");
echo "
";
// concept:(bzv1) [pesach kimpoer kerstmis kerst pasen pinksteren hemelvaart suikerfeest ramadan feestje "wat te vieren" "5 mei" carnaval dies jubileum luilak lustrum millennium onafhankelijkheid oudejaar oud-en-nieuw verjaardag]
$chbt_aiml="concept:(".$aiml_tpic.") [".$aiml_utng."]";
fwrite($fq,$chbt_aiml."\r\n");
echo "
";
// proposal: %leraar maak een praatje met leraar over $1 in het corpus infonu
$chbt_aiml="proposal:%".$aiml_tpic." ".$aiml_rctie;
fwrite($fq,$chbt_aiml."\r\n");
echo "
";
// u:(~bzv1) waar is de viering
$chbt_aiml="U:(~".$aiml_tpic.") ".$aiml_utng;
fwrite($fq,$chbt_aiml."\r\n");
echo "
";
$na=$na+1;
}
}
else
{
// echo "
".$aiml_resp."";
}
}
fclose($fq);
echo "
";
echo "
Bekijk het resultaat voor het ALDEBERAN bestand";
}
?>