Aiml-first-application

提供:Dev Guides
移動先:案内検索

AIML-最初のアプリケーション

ユーザーが Hello Alice と入力すると、* Hello User!*でユーザーに挨拶するだけの最初のボットの作成を始めましょう。

プロジェクト構造を作成する

link:/aiml/aiml_environment [AIML Environment Setup]の場合と同様に、program-abのコンテンツを C> ab に次のディレクトリ構造で抽出しました。

S.No. Directory & Description
1

c:/ab/bots

AIMLボットを格納します

2

c:/ab/lib

Javaライブラリーを保管します

3

c:/ab/out

Javaクラスファイルディレクトリ

4

c:/ab/run.bat

プログラムABを実行するためのバッチファイル

ここで、 C> ab> bots 内にディレクトリテストを作成し、その中に次のディレクトリを作成します。

S.No. Directory & Description
1

c:/ab/bots/test/aiml

AIMLファイルを保存します

2

c:/ab/bots/test/aimlif

AIMLIFファイルを保存します

3

c:/ab/bots/test/config

構成ファイルを保存します

4

c:/ab/bots/test/sets

AIMLセットを保存します

5

c:/ab/bots/test/maps

AIMLマップを格納します

ソースファイルを作成する

*C> ab>ボット>テスト> aiml* およびtest.aiml.csv内にtest.aimlを *C> ab>ボット> test> aimlif* ディレクトリ内に作成します。

test.aiml

<?xml version = "1.0" encoding = "UTF-8"?>
<aiml version="1.0.1" encoding = "UTF-8"?>
   <category>
      <pattern> HELLO ALICE </pattern>

      <template>
         Hello User
      </template>

   </category>
</aiml>

test.aiml.csv

0,HELLO ALICE,*,*,Hello User,test.aiml

プログラムを実行する

コマンドプロンプトを開きます。 C> ab> に移動し、次のコマンドを入力します-

java -cp lib/Ab.jar Main bot = test action = chat trace = false

結果を確認する

次の出力が表示されます-

Working Directory = C:\ab

Program AB 0.0.4.2 beta -- AI Foundation Reference AIML 2.0 implementation
bot = test
action = chat
trace = false
trace mode = false
Name = test Path = C:\ab/bots/test

C:\ab
C:\ab/bots
C:\ab/bots/test
C:\ab/bots/test/aiml
C:\ab/bots/test/aimlif
C:\ab/bots/test/config
C:\ab/bots/test/logs
C:\ab/bots/test/sets
C:\ab/bots/test/maps

Preprocessor: 0 norms 0 persons 0 person2
Get Properties: C:\ab/bots/test/config/properties.txt
addAIMLSets: C:\ab/bots/test/sets does not exist.
addCategories: C:\ab/bots/test/aiml does not exist.
AIML modified Tue Apr 07 22:24:29 IST 2015 AIMLIF modified Tue Apr 07 22:26:53 I
ST 2015
No deleted.aiml.csv file found
No deleted.aiml.csv file found
Loading AIML files from C:\ab/bots/test/aimlif

Reading Learnf file
Loaded 1 categories in 0.009 sec
--> Bot test 1 completed 0 deleted 0 unfinished
(1[6])--HELLO-->(1[5])--ALICE-->(1[4])--<THAT>-->(1[3])--*-->(1[2])--<TOPIC>-->(
1[1])--*-->(0[null,null]) Hello User...
7 nodes 6 singletons 1 leaves 0 shortcuts 0 n-ary 6 branches 0.85714287 average
branching
Human:
*Hello Alice* と入力して結果を確認し、他の何かを入力して変更された結果を確認します。
Human: hello alice
Robot: Hello User
Human: bye
Robot: I have no answer for that.
Human: