Ai Dreams Forum

Chatbots => A.L.I.C.E (AIML) => Topic started by: MarcosNunes on December 04, 2016, 08:58:31 pm

Title: Sending a sray from pt to en to another bot and getting en answer
Post by: MarcosNunes on December 04, 2016, 08:58:31 pm
I am implementing this aiml code but something is still wrong.



//This code makes the bot ask one last entry on the conversation to another bot

<?xml version="1.0" encoding="ISO-8859-1"?>
<aiml version="1.0">



<category>
    <pattern>PERGUNTA PRA ELE</pattern>
    <template>O Marcos disse: "<sraix apikey="14336129"><sraix service="xml" hint="text">https://translate.yandex.net/api/v1.5/tr/translate?key=trnsl.1.1.20161129T203417Z.cddcfcddb468b5b3.a83995300ccfc2b75292556bca8c9f4617c95d0f&lang=pt-en&format=plain&text={srai (conversation.getLast(#input, 2).input)}</sraix></sraix>"</template>
</category>

<category>
    <pattern>PERGUNTE A ELE</pattern>
    <template>O Marcos disse: "<sraix apikey="14336129"><sraix service="xml" hint="text">https://translate.yandex.net/api/v1.5/tr/translate?key=trnsl.1.1.20161129T203417Z.cddcfcddb468b5b3.a83995300ccfc2b75292556bca8c9f4617c95d0f&lang=pt-en&format=plain&text={srai (conversation.getLast(#input, 2).input)}</sraix></sraix>"</template>
</category>

<category>
    <pattern>PERGUNTE PRA ELE</pattern>
    <template>O Marcos disse: "<sraix apikey="14336129"><sraix service="xml" hint="text">https://translate.yandex.net/api/v1.5/tr/translate?key=trnsl.1.1.20161129T203417Z.cddcfcddb468b5b3.a83995300ccfc2b75292556bca8c9f4617c95d0f&lang=pt-en&format=plain&text={srai (conversation.getLast(#input, 2).input)}</sraix></sraix>"</template>
</category>

</aiml>

Parsing error occurred - org.xml.sax.SAXParseException; lineNumber: 23; columnNumber: 3; The markup in the document following the root element must be well-formed.




p.s The conversation is running in Portuguese but the second bot answers in English one previous sent portuguese input

If you can help me... Please!
Modify message
Title: Re: Sending a sray from pt to en to another bot and getting en answer
Post by: Freddy on December 04, 2016, 09:14:45 pm
Marcos please....

The button to the right called "Report to Moderator" is NOT the method to contact support. It is only if someone has done something wrong in your view.

I've had loads of reports from you which turned out to be normal messages.  :o

If you are having difficulty please post here with your issue :

http://aidreams.co.uk/forum/index.php?board=50.0 (http://aidreams.co.uk/forum/index.php?board=50.0)

Thank you :)
Title: Re: Sending a sray from pt to en to another bot and getting en answer
Post by: MarcosNunes on December 04, 2016, 10:46:54 pm
May this can be the starter code to the implement above...



// Asks to Marcos Nunes the last input on the conversation
state Topic {
   pattern "pergunta a ele" template Template("O Marcos disse: "<sraix apikey="14336129"><sraix service="xml" hint="text">https://translate.yandex.net/api/v1.5/tr/translate?key=trnsl.1.1.20161129T203417Z.cddcfcddb468b5b3.a83995300ccfc2b75292556bca8c9f4617c95d0f&lang=pt-en&format=plain&text={srai (\"{conversation.getLast(#input, 5).input}\")}</sraix></sraix>");

   function moreResponse() {
      topic = conversation.topic;
      if (topic == null) {
         return null;
      }
      more = topic.paragraph;
      if (more == null) {
         Template("That is all I know about {topic}.");
      } else {
         more;
      }
   }
}