Chatbot and the Error: wrong type argument in Position

120 views
Skip to first unread message

vishnup...@gmail.com

unread,
Aug 28, 2016, 3:17:26 PM8/28/16
to opencog
Hello all,

I tried chatbot demonstration. I had my Relex and Cog server running.  I got the Error "wrong type argument". 

guile> (nlp-parse john is generous")
guile> (process-query "Priya" "who is generous?")

Hello Priya, you said: "who is generous?"
You made an Interrogative SpeechAct
wrong-type-arg
(display Wrong type argument in position ~A: ~S (2 0) (0))
Sorry, I don't understand it

----------------------------------------------------------------

I also tried chatbot-psi 

I did the following steps.:
guile> (use-modules (opencog) (opencog nlp) (opencog nlp aiml) (opencog openpsi))
guile> (add-to-load-path "/home/vishnu/Documents/opencog_relatedPackages/opencog/opencog/nlp/chatbot-psi")
guile> (load-from-path "main.scm")
guile> (load-from-path "aiml-rules.scm")

guile> (aiml-get-response-wl (token-seq-of-sent "hello"))


ERROR: In procedure apply-smob/1:

ERROR: In procedure cog-type: Wrong type argument in position 1 (expecting opencog atom): "hello"
ABORT: wrong-type-arg

-----------------------------------------------------------------

Am i missing anything? how can i solve the problem?  Any guidelines would be very much  helpful. 


Thanks in advance.




Linas Vepstas

unread,
Aug 28, 2016, 9:19:48 PM8/28/16
to opencog
Dunno. You may want to open a github report, and provide some additional details, like which modules you loaded, etc. 

This code is being hacked on almost every day; maybe something got broken recently.

--linas

--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/325457a4-ffb5-4456-9a1d-5f37c7f83cba%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

vishnup...@gmail.com

unread,
Aug 29, 2016, 4:46:32 AM8/29/16
to opencog


ok Linas. I shall provide additional details in github. Thanks!

--Vishnu 
Message has been deleted
Message has been deleted

vishnup...@gmail.com

unread,
Aug 31, 2016, 9:11:42 AM8/31/16
to opencog, linasv...@gmail.com

I tried chatbot demonstration also by installing https://github.com/hansonrobotics/HEAD. I did not compile and install the modules (such as atomspace, cogutils, opencog...) manually. It itself automatically installed all the modules required. But then also i got the following error.

guile> (process-query "Priya" "who is generous?")
Hello Priya, you said: "who is generous?"
You made an Interrogative SpeechAct

Linas Vepstas

unread,
Aug 31, 2016, 12:27:58 PM8/31/16
to vishnupriya kumar, opencog
That last bit is printed by  nlp/chatbot/bot-api.scm line 83 when an exception is caught. Right before that, it should print the actual exception -- if nothing else, it should print two newline characters.  Are you saying that there was no exception text printed? 

I just changed the code to print "Sorry, I caught an exception\n" instead of "Sorry, I don't understand it" just to make that clear.

--linas

vishnup...@gmail.com

unread,
Sep 1, 2016, 8:22:13 AM9/1/16
to opencog, vishnup...@gmail.com, linasv...@gmail.com
Now it says, it caught an Exception, which is as follows:

guile> Hello luser, you said: "are you a bot"
You asked a Truth Query
I can't process truth query for now

guile> (nlp-parse "mary eats apple")
((SentenceNode "sentence@b2d9f1db-524d-4c79-a7e2-5e28f0db00b2")
)
guile> (nlp-parse "tom eats mango")
((SentenceNode "sentence@b3820f2c-5ae4-4029-ab0d-089d790ca0e2")
)
guile>    (process-query "luser" "who eats apple")
Hello luser, you said: "who eats apple"
You made an Interrogative SpeechAct
wrong-type-arg
(display Wrong type argument in position ~A: ~S (2 0) (0))
Sorry, I caught an exception

But what is this wrong type argument?
How can i fix this?

Linas Vepstas

unread,
Sep 1, 2016, 4:37:14 PM9/1/16
to vishnupriya kumar, opencog
well, its hard to guess where it is, without a backtrace.  You should add these lines to your `~/.guile` file:
```
(debug-enable 'backtrace)
;;; Record positions of source code expressions.
  (read-enable 'positions)
```

I believe that the above should be enough to pinpoint the issue.

--linas

vishnup...@gmail.com

unread,
Sep 1, 2016, 6:00:40 PM9/1/16
to opencog, vishnup...@gmail.com, linasv...@gmail.com


My .guile file is as follows : 

(use-modules (ice-9 readline)) (activate-readline)
(debug-enable 'backtrace)
;;; Record positions of source code expressions.
(read-enable 'positions)
(add-to-load-path "/usr/local/share/opencog/scm")
(add-to-load-path ".")
(use-modules (opencog))
(use-modules (opencog nlp chatbot))
(use-modules (opencog query))
(use-modules (opencog exec))
(load-from-path "opencog.scm") 


But sill i did not get any backtrace! am i missing anything here?

Linas Vepstas

unread,
Sep 1, 2016, 7:10:11 PM9/1/16
to vishnupriya kumar, opencog
Sigh.  I guess the catch was suppressing the print.  The following will print this:


--linas

vishnup...@gmail.com

unread,
Sep 2, 2016, 1:24:02 AM9/2/16
to opencog, vishnup...@gmail.com, linasv...@gmail.com
This is the Backtrace.

guile>    (process-query "luser" "who threw stone")
Hello luser, you said: "who threw stone"
You made an Interrogative SpeechAct

Backtrace:
In ice-9/boot-9.scm:
 157: 18 [catch #t #<catch-closure 3d84560> ...]
In unknown file:
   ?: 17 [apply-smob/1 #<catch-closure 3d84560>]
In ice-9/boot-9.scm:
 157: 16 [catch #t #<catch-closure 3d85ec0> ...]
In unknown file:
   ?: 15 [apply-smob/1 #<catch-closure 3d85ec0>]
   ?: 14 [call-with-input-string "   (process-query \"luser\" \"who threw stone\")\n" ...]
In ice-9/boot-9.scm:
2401: 13 [save-module-excursion #<procedure 3d5eb70 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
  44: 12 [read-and-eval #<input: string 3de4dd0> #:lang ...]
  37: 11 [lp (process-query "luser" "who threw stone")]
In ice-9/boot-9.scm:
 171: 10 [with-throw-handler #t ...]
In opencog/nlp/chatbot/bot-api.scm:
  19: 9 [wh_query_process #]
In opencog/nlp/fuzzy.scm:
 198: 8 [get-fuzzy-answers # # #t]
In srfi/srfi-1.scm:
 646: 7 [append-map #<procedure 292c740 at opencog/nlp/fuzzy.scm:76:16 (r)> (# #)]
 578: 6 [map #<procedure 292c740 at opencog/nlp/fuzzy.scm:76:16 (r)> (# #)]
In opencog/nlp/fuzzy.scm:
  83: 5 [#<procedure 292c740 at opencog/nlp/fuzzy.scm:76:16 (r)> #]
In debug-trace.scm:
  33: 4 [trace-msg "gen-sentences spe-act is "]
In unknown file:
   ?: 3 [display "gen-sentences spe-act is " 0]
In ice-9/boot-9.scm:
 102: 2 [#<procedure 3d80cc0 at ice-9/boot-9.scm:97:6 (thrown-k . args)> wrong-type-arg ...]
In opencog/nlp/chatbot/bot-api.scm:
  87: 1 [#<procedure 2f988c0 at opencog/nlp/chatbot/bot-api.scm:86:7 args> wrong-type-arg ...]
In unknown file:
   ?: 0 [backtrace #<undefined>]

Sorry, I caught an exception
Backtrace:
In ice-9/boot-9.scm:
 157: 18 [catch #t #<catch-closure 3d84560> ...]
In unknown file:
   ?: 17 [apply-smob/1 #<catch-closure 3d84560>]
In ice-9/boot-9.scm:
 157: 16 [catch #t #<catch-closure 3d85ec0> ...]
In unknown file:
   ?: 15 [apply-smob/1 #<catch-closure 3d85ec0>]
   ?: 14 [call-with-input-string "   (process-query \"luser\" \"who threw stone\")\n" ...]
In ice-9/boot-9.scm:
2401: 13 [save-module-excursion #<procedure 3d5eb70 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
  44: 12 [read-and-eval #<input: string 3de4dd0> #:lang ...]
  37: 11 [lp (process-query "luser" "who threw stone")]
In ice-9/boot-9.scm:
 171: 10 [with-throw-handler #t ...]
In opencog/nlp/chatbot/bot-api.scm:
  19: 9 [wh_query_process #]
In opencog/nlp/fuzzy.scm:
 198: 8 [get-fuzzy-answers # # #t]
In srfi/srfi-1.scm:
 646: 7 [append-map #<procedure 292c740 at opencog/nlp/fuzzy.scm:76:16 (r)> (# #)]
 578: 6 [map #<procedure 292c740 at opencog/nlp/fuzzy.scm:76:16 (r)> (# #)]
In opencog/nlp/fuzzy.scm:
  83: 5 [#<procedure 292c740 at opencog/nlp/fuzzy.scm:76:16 (r)> #]
In debug-trace.scm:
  33: 4 [trace-msg "gen-sentences spe-act is "]
In unknown file:
   ?: 3 [display "gen-sentences spe-act is " {0}]
In ice-9/boot-9.scm:
 106: 2 [#<procedure 3d80cc0 at ice-9/boot-9.scm:97:6 (thrown-k . args)> wrong-type-arg ...]
 102: 1 [#<procedure 3d80d80 at ice-9/boot-9.scm:97:6 (thrown-k . args)> wrong-type-arg ...]
In unknown file:
   ?: {0} [apply-smob/1 #<catch-closure 3d85780> wrong-type-arg ...]

ERROR: In procedure apply-smob/1:
ERROR: In procedure display: Wrong type argument in position 2: 0
ABORT: wrong-type-arg


Leung Man Hin

unread,
Sep 2, 2016, 7:26:31 PM9/2/16
to vishnup...@gmail.com, ope...@googlegroups.com
it is recommended to use the newer chatbot (chatbot-psi) via the `chat` commend, e.g. (chat "who is generous?"), or call it via the webui with HEAD running, thanks


--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.

Linas Vepstas

unread,
Sep 2, 2016, 7:36:46 PM9/2/16
to opencog, vishnupriya kumar
Hmm. 

Man Hin, the process-query interfaces work fine for me, I cannot reproduce the above error. The stack trace points at line 76 of fuzzy.scm  as the source of the problem.  But then it says that its argument 2, and argument 2 is at line 100 

My guess is that setlinks is not an actual guile list, which is what append-map is expecting. Adding additional prints to this code might clarify the fault.

Why its broken only for Vishnu, and not for me, I don't know.

--linas



vishnup...@gmail.com

unread,
Sep 3, 2016, 4:54:15 PM9/3/16
to opencog


But using chat-bot psi, i thought, we can only ask pre-defined questions that are in aiml file?!  If i need to ask "who is generous", then in the scm file should be  there a question "who is generous" and it's corresponding answer ?!
      Nevertheless,  when i do (chat "what is ai"), it shows unbound variable: chat.

guile> (chat "what is ai")
Backtrace:
In ice-9/boot-9.scm:
 157: 12 [catch #t #<catch-closure 2f1cfe0> ...]
In unknown file:
   ?: 11 [apply-smob/1 #<catch-closure 2f1cfe0>]
In ice-9/boot-9.scm:
 157: 10 [catch #t #<catch-closure 2f1cb80> ...]
In unknown file:
   ?: 9 [apply-smob/1 #<catch-closure 2f1cb80>]
   ?: 8 [call-with-input-string "(chat \"what is ai\")\n" ...]
In ice-9/boot-9.scm:
2401: 7 [save-module-excursion #<procedure 3631900 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
  44: 6 [read-and-eval #<input: string 32ce820> #:lang ...]
  37: 5 [lp (chat "what is ai")]
In ice-9/eval.scm:
 386: 4 [eval #<memoized (chat (quote "what is ai"))> ()]
 393: 3 [eval #<memoized chat> ()]
In unknown file:
   ?: 2 [memoize-variable-access! #<memoized chat> #<directory # 24cfc60>]
In ice-9/boot-9.scm:
 102: 1 [#<procedure 2eed580 at ice-9/boot-9.scm:97:6 (thrown-k . args)> unbound-variable ...]
In unknown file:
   ?: 0 [apply-smob/1 #<catch-closure 2f1cb40> unbound-variable ...]

ERROR: In procedure apply-smob/1:
ERROR: Unbound variable: chat
ABORT: unbound-variable


 

Leung Man Hin

unread,
Sep 9, 2016, 7:14:27 PM9/9/16
to ope...@googlegroups.com
Things work fine for me too... Vishnu, could you double check if you are running all the latest codes, clean the cache (`rm -r ~/.cache/guile`), rebuild everything then try again and see if it works?


--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
Reply all
Reply to author
Forward
0 new messages