
Problema con customtag para AIML y php
Publicado por jorge (1 intervención) el 11/10/2015 05:16:16
Estoy queriendo hacer hablar al charbot de "program E" y me topé con varios problemas problemas, creo haber ido solucionando algunos pero ahora me pasa que hay una parte que no entiendo y estoy estancado ahí.
No soy muy habil para explicarme así que voy a mostrar por partes que para mi es mas facil.
Espero no complicarla mucho.
Este es el código que no entiendo:
y esto viene en el archivo customtag.php
(que dicho sea, de paso, no se si está de ejemplo o que)
No soy muy habil para explicarme así que voy a mostrar por partes que para mi es mas facil.
Espero no complicarla mucho.
Este es el código que no entiendo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function loadcustomtags(){
global $cttags;
$cttags=array();
$definedfuncs = get_defined_functions();
$definedfuncs=$definedfuncs["user"];
// find all funcs in ["user"] funcs that match ct_??? and register each function and tag name
foreach($definedfuncs as $x){
if (substr($x,0,3)=="ct_"){
$cttags[]=strtoupper(substr($x,3,strlen($x)));
}
}
}
y esto viene en el archivo customtag.php
(que dicho sea, de paso, no se si está de ejemplo o que)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
Example:
You want to build math capabilities into the bot and have invented an <add> tag.
Example of how your new add tag will be used:
<category>
<pattern>PLEASE ADD * TO *</pattern>
<template>The answer is <add><star index="1"/>,<star index="2"/></add></template>
</category>
*/
/*
function ct_add($xmlnode,$inputstar,$thatstar,$topicstar){
$total=0;
# Process everything inside the tag
$numberstoadd=recursechildren(realchild($xmlnode),$inputstar,$thatstar,$topicstar);
# Split the numbers into an array
$numberstoadd=split(",",$numberstoadd);
# Total up the numbers
foreach($numberstoadd as $x)
$total += $x;
# Return the answer
return $total;
}
*/
Valora esta pregunta


0