5. ELIZA
cl-user(2): (eliza)
eliza> hello.
How do you do. Please state your problem.
eliza> My problem is about my father.
Your father
eliza> Yes, he is gone.
Go on
eliza> But, I am not moved by it.
Do you want to be not moved by it ?
eliza> No, no. I think people usually feel sad when
their parents die.
You are being a bit negative
eliza> Is it so? Anyway I think I am not normal.
In what way are you not normal
eliza> I cannot cry after the death of my father.
Does he influence you strongly?
eliza> Well, I think not so much.
Go on
eliza>
cl-user(33): (eliza)
eliza> お願いします
どうかしましたか
eliza> 最近 どうも 元気が ないのです
どうしてそう思うのですか?
eliza> 私は 小さいときから 親からしかられたことがない
のですが,
続けてください
eliza> それで はたして よかったのかなと 思います
よく それで はたして よかったのかなと 思うのですか?
eliza> はい. よく そう 思います
ほかにどんなことを思いますか?
eliza> そうですね.もし兄弟がいたら 私は どうだったろう
かとか
続けてください
eliza> そうそう.最近は よく 眠れないのです
気にかかっていることは 何ですか?
eliza> いや,時間がないんで,これで 失礼します
good bye ごきげんよう
nil
6. ELIZA (cont.)
((((?* ?x) hello (?* ?y))
(How do you do. Please state your problem.))
(((?* ?x) computer (?* ?y))
(Do computers worry you?) (What do you think about machines?)
(Why do you mention computers?)
(What do you think machines have to do with your problem?))
(((?* ?x) name (?* ?y))
(I am not interested in names))
(((?* ?x) sorry (?* ?y))
(Please don't apologize) (Apologies are not necessary)
(What feelings do you have when you apologize))
(((?* ?x) I remember (?* ?y))
(Do you often think of ?y)
(Does thinking of ?y bring anything else to mind?)
(What else do you remember) (Why do you recall ?y right now?)
(What in the present situation reminds you of ?y)
(What is the connection between me and ?y))
(((?* ?x) do you remember (?* ?y))
(Did you think I would forget ?y ?)
(Why do you think I should recall ?y now)
(What about ?y) (You mentioned ?y))
(((?* ?x) if (?* ?y))
(Do you really think its likely that ?y) (Do you wish that ?y)
(What do you think about ?y) (Really-- if ?y))
(((?* ?x) I dreamt (?* ?y))
(Really-- ?y) (Have you ever fantasized ?y while you were awake?)
(Have you dreamt ?y before?))
cl-user(8): (defrule 挨拶
お願いします ->
(どうかしましたか))
挨拶
cl-user(9): (defrule 不眠
(?* ?z) 眠れないのです ->
(気にかかっていることは 何ですか?))
不眠
cl-user(10): (defrule したいこと
(?* ?z) したいのです ->
(どうして ?z したいのですか?))
したいこと
cl-user(11): (defrule 否定的
(?* ?x) ないのです ->
(そんなに否定的に思う必要はありませんよ)
(どうしてそう思うのですか?))
否定的
cl-user(12): (defrule 抽象的
(?* ?x) 私は (?* ?y) ->
(続けてください))
抽象的
cl-user(13): (defrule 思い
(?* ?x) 思います ->
(よく ?x 思うのですか?)
(ほかにどんなことを思いますか?))
思い
cl-user(14): (defrule 終了
(?* ?z) 失礼します ->
(good bye ごきげんよう))
終了
7. ELIZA 対話エンジンと対話ルール
cl-user(8): (defrule 挨拶
お願いします ->
(どうかしましたか))
挨拶
cl-user(9): (defrule 不眠
(?* ?z) 眠れないのです ->
(気にかかっていることは 何ですか?))
不眠
cl-user(10): (defrule したいこと
(?* ?z) したいのです ->
(どうして ?z したいのですか?))
したいこと
cl-user(11): (defrule 否定的
(?* ?x) ないのです ->
(そんなに否定的に思う必要はありませんよ)
(どうしてそう思うのですか?))
否定的
cl-user(12): (defrule 抽象的
(?* ?x) 私は (?* ?y) ->
(続けてください))
抽象的
cl-user(13): (defrule 思い
(?* ?x) 思います ->
(よく ?x 思うのですか?)
(ほかにどんなことを思いますか?))
思い
cl-user(14): (defrule 終了
(?* ?z) 失礼します ->
(good bye ごきげんよう))
終了
(defun eliza ()
"Respond to user input using pattern matching rules."
(loop
(print 'eliza>)
(let* ((input (read-line-no-punct))
(response (flatten (use-eliza-rules input))))
(print-with-spaces response)
(if (pat-match '((?* ?x) good bye (?* ?y)) response) (return)))))
(defun use-eliza-rules (input)
"Find some rule with which to transform the input."
(some #'(lambda (rule)
(let ((result (pat-match (rule-pattern rule) input)))
(unless (eq result fail)
(sublis (switch-viewpoint result)
(random-elt (rule-responses rule))))))
*eliza-rules*))
(defun switch-viewpoint (words)
"Change I to you and vice versa, and so on."
(sublis '((I . you) (you . I) (me . you) (am . are))
words))
25. System Implementation
Action Planning based on Open Knowledge Graphs and LOD
The Fourth International Workshop on Practical Application
of Ontology for Semantic Data Engineering (PAOS 2017)
31. System Implementation
ライオンが見たいな
ライオン が 見 たい な
[要望]ライオン 見る
一番近くの場所を案内します。
距離は3.0625353kmです。
場所:恩賜上野動物園
緯度:35.7175
経度:139.771
URL :
"http://ja.dbpedia.org/resource/
恩賜上野動物園"
Action Planning based on Open Knowledge Graphs and LOD
The Fourth International Workshop on Practical Application
of Ontology for Semantic Data Engineering (PAOS 2017)