Wussten Sie Bot Libre bietet auch kostenlosen hosted issue-tracking für Ihre website oder mobile app?
Self, AIML, and scripting

Dealing with sets in AIML on botlibre

durch pranavlal gepostet Feb 25 2017, 4:52

Hi all,
I have a set of over 1000 words which forms the vocabulary of my bot. How do I implement this in botlibre? I see the way the colors set is done in json using name value pairs but here, it is just a set of words. If the input from the user does not contain those words, then the question may not pertain to information security and the bot should not try to search or answer the question. I still however need the question to be logged. Can I do this on the bot libre platform?


by admin posted Feb 25 2017, 7:24
If you define all of the bot's responses with one of these keywords, then the bot will use its default response for any off topic question. You can have your default response respond however you wish, or not respond at all using the following template,

Template("")

For a script, if you want to check if the users input has any of your words, you would need to tag all of these words in the bot's knowledgebase.

If you had already set them all as keywords in your responses, then they will already be tagged with #keyword.

To check if a sentence has any keywords in a Self script use,
var hasKeyword = false; for (word in sentence.word) { if (word.has(#instantiation, #keyword)) { hasKeyword = true; break; } }


You can create a JSON file to tag your keywords,

[ {#data:"security",instantiation:#keyword} {#data:"hackers",instantiation:#keyword} ]


Updated: Feb 25 2017, 7:26
Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1697, today: 1, week: 3, month: 24

by pranavlal posted Feb 28 2017, 6:39

Hi,

Many thanks for your response. My bot is in an AIML script.  I have over a thousand keywords in a large text file.

How do I convert that file to JSON?

In addition, where do I put the self script in the bot? Yes, there is the scripts upload page. Do I just upload the script or do I need to add the script to my AIML template in some way?


Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1704, today: 0, week: 2, month: 30

by admin posted Feb 28 2017, 8:07
If you want to access complex data objects, you need to use Self.
AIML can only access "set" and "map" data.

You would need to convert your file format to JSON manually, or using some sort of script to do it.

To define an AIML set, use the following JSON format,

https://www.botlibre.com/script?id=14047448

You can import JSON data from your bot's Knowledge page.

If you upgrade to our Platinum service, or Bot Libre for Business Enterprise, we can help you convert and import the file.

Thumbs up: 0, thumbs down: 0, stars: 0.0
Views: 1928, today: 0, week: 1, month: 26

Id: 15590456
Gepostet: Feb 25 2017, 4:52
Antworten: 3
Ansichten: 2093, heute: 1, Woche: 2, Monat: 27
0 0 0.0/5