Tag Archives: 人工智能

Alicebot 无法解析中文 AIML

最近在研究关于智能机器人对话方面的文章,发现了AI界认可度最高的Alice,下载了Java版Alicebot的实现-ChatterBean。跑起来之后发现英文语义没有问题都可以做出答复,但是汉语词语提交给Alice引擎时一直返回*所匹配的template。起初怀疑是请求串String提取时转码问题但将所有编码均改为UTF-8时问题依旧存在,后来查阅文档才发现请求的字符串需要前后添加空格、AIML文档中的pattern标签也需要做同样的处理。经过这样之后就能成功返回匹配结果了 。

附中文字符串分拆加空格代码

 

 

人工智能标记语言 AIML Tag

v1.0.1

标签 含义 备注
<aiml> 3.2. AIML Element AIML block delimeter
<topic name=”X”> 4. Topic X is AIML pattern
<category> 5. Category AIML knowledge unit
<pattern> 6. Pattern AIML input pattern
<that> 6.1. Pattern-side That contains AIML pattern
<template> 7. Template AIML response template
<star index=”N”/> 7.1.1. Star binding of *
<that index=”M,N”/> 7.1.2. Template-side That previous bot utterance
<input index=”N”/> 7.1.3. Input input sentence
<thatstar index=”N”/> 7.1.4. Thatstar binding of * in that
<topicstar index=”N”/> 7.1.5. Topicstar binding of * in topic
<get name=”XXX”/> 7.1.6. Get Botmaster defined XXX, default
<bot name=”XXX”/> 7.1.6.1. Bot Custom bot parameter
<sr/> 7.1.7. Short-cut elements <srai><star/></srai>
<person2/> 7.1.7. Short-cut elements <person2><star/></person2;>
<person/> 7.1.7. Short-cut elements <person><star/></person;>
<gender/> 7.1.7. Short-cut elements <gender><star/></gender;>
<date/> 7.1.8. System-defined predicates date and time
<id/> 7.1.8. System-defined predicates client identifer
<size/> 7.1.8. System-defined predicates # of categories loaded
<version/> 7.1.8. System-defined predicates AIML program version
<uppercase> 7.2.1. Uppercase convert all text to Uppercase
<lowercase> 7.2.2. Lowercase convert all text to Lowercase
<formal> 7.2.3. Formal capitalize every word
<sentence> 7.2.4. Sentence capitalize the first word
<condition name=”X” value=”Y”> 7.3.1. Condition One shot branch
<condition name=”X”> 7.3.1. Condition Single predicate branch
<condition> 7.3.1. Condition Multi predicate branch
<random> 7.3.2. Random Random uniform selection
<li name=”X” value=”Y”> 7.3.1. Condition used by <condition>
<li value=”Y”> 7.3.1. Condition used by <condition>
<li> 7.3.2. Random used by <random>,<condition>
<set name=”XXX”> 7.4.1. Set May return XXX or value
<gossip> 7.4.2. Gossip Append to file
<srai> 7.5.1. SRAI Recursion
<person2> 7.6.1. Person2 swap 1st & 3rd person
<person> 7.6.2. Person swap 1st & 2nd person
<gender> 7.6.3. Gender change gender pronouns
<think> 7.7.1. Think Hides side-effects
<learn> 7.7.2. Learn AIML loading
<system> 7.8.1. System platform-dependent
<javascript> 7.8.2. JavaScript Javascript