- 
                Notifications
    
You must be signed in to change notification settings  - Fork 135
 
Tutorial List Processing
The ability to process a string of words individually is a key component of any language parsing tool and AIML is no different. AIML provides 2 tags to split and combine single words into a string of individual letters separated by spaces, and then 2 functions which operate on any string of words or letters separated by strings.
- explode - Convert a single word into a string of individual letters separated by spaces.
 - implode - Take a string of letters or words separated by spaces and combine into a single string with no spaces.
 - first - Return the first element of a string of space-separated words.
 - rest - Return all but the first element of a string of space-separated words.
 
Convert a single word into a string of individual letters separated by spaces.
<category>
    <pattern>WHAT ARE THE LETTERS OF *</pattern>
    <template>
        <explode><star /></explode>
    </template>
</category>Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> WHAT ARE THE LETTERS OF IBM
I B MTake a string of letters or words separated by spaces and combine into a single string with no spaces.
<category>
    <pattern>IMPLODE </pattern>
    <template>
        <implode><star /></implode>
    </template>
</category>Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> IMPLODE I B M
IBMReturn the first element of a string of space-separated words.
<category>
    <pattern>FIRST WORD OF *</pattern>
    <template>
        <first><star /></first>
    </template>
</category>Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> FIRST WORD OF THE QUICK BROWN FOX
THEReturn all but the first element of a string of space-separated words.
<category>
    <pattern>EVERYTHING BUT THE FIRST WORD OF * </pattern>
    <template>
        <rest><star /></rest>
    </template>
</category>Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot version 0.0.1, initiated March 14, 2017
Hi, how can I help you today?
>>> Everything but the first word of the quick brown fox
quick brown foxBack to Tutorial | Back - Grammar Manipulation) | Next - Knowledge Management
Email: [email protected] | Twitter: @keiffster | Facebook: keith.sterling | LinkedIn: keithsterling | My Blog
- Home
 - Background
 - Guiding Principles
 - Reporting an Issue
 - Installation
 - You And Your Bot
 - Bots
 - Clients
 - Configuration
 - AIML
 - Sentence Splitting
 - Natural Langauge Processing
 - Normalization
 - Spelling
 - Sentiment Analysis
 - Translation
 - Security
 - Hot Reload
 - Logging
 - Out of Band
 - Multi Language
 - RDF Support
 - Rich Media
 - Asynchronous Events
 - Triggers
 - External Services
 - Dynamic Sets, Maps & Vars
 - Extensions
 - Pre & Post Processors
 - Custom Nodes
 - The Brain Tree
 - Utilities
 - Building It Yourself
 - Creating Your Own Bot
 - Contributing
 - Performance Testing
 - FAQ
 - History
 - Website