Giter Club home page Giter Club logo

Comments (7)

noskill avatar noskill commented on June 9, 2024 1

it works:

python_atomspace = AtomSpace()
scheme_eval(python_atomspace, "(use-modules (opencog) (opencog exec))")
atomspace = scheme_eval_as('(cog-atomspace)')

from opencog.

linas avatar linas commented on June 9, 2024

My first guess is that the python bindings are broken, again. Both @noskill and @vsbogd use python regularly, maybe they know ...

from opencog.

aivanouski avatar aivanouski commented on June 9, 2024

it works:

python_atomspace = AtomSpace()
scheme_eval(python_atomspace, "(use-modules (opencog) (opencog exec))")
atomspace = scheme_eval_as('(cog-atomspace)')

Thank you! It works.
But happened new error:
In procedure module-lookup: Unbound variable: cog-extract-recursive

Ok, we got message Help
2020-08-21 15:04:33,944 - telegram.ext.dispatcher - ERROR - An error was raised while processing the update and an uncaught error was raised while handling the error with an error_handler
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 340, in process_update
    handler.handle_update(update, self, check, context)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/handler.py", line 122, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "../opencog/nlp/chatbot/telegram_bot.py", line 52, in echo
    reply = scheme_eval(atomspace, '(process-query "{}" "{}")'.format(update.message.from_user.first_name, update.message.text))
  File "scheme.pyx", line 44, in opencog.scheme.scheme_eval
RuntimeError: Python-Scheme Wrapper: Failed to execute '(process-query "Andrei" "Help")'

Backtrace:
          11 (apply-smob/1 #<catch-closure 1c73220>)
          10 (apply-smob/1 #<catch-closure 1c73120>)
In ice-9/boot-9.scm:
   2312:4  9 (save-module-excursion #<procedure 1c77c20 at ice-9/eva…>)
In ice-9/eval-string.scm:
     38:6  8 (read-and-eval #<input: string 1d8e5b0> #:lang _)
In ice-9/boot-9.scm:
    841:4  7 (with-throw-handler _ _ _)
In opencog/nlp/chatbot/bot-api.scm:
    39:35  6 (_)
In opencog/nlp/chatbot/chat-utils.scm:
    182:8  5 (nlp-parse "Help")
In srfi/srfi-1.scm:
    640:9  4 (for-each #<procedure 7f0d43957868 at opencog/nlp/proc…> …)
In opencog/nlp/processing-utils.scm:
    57:18  3 (_ _)
In ice-9/boot-9.scm:
   751:25  2 (dispatch-exception 0 unbound-variable ("module-look…" …))
In opencog/nlp/chatbot/bot-api.scm:
    83:12  1 (_ . _)
In unknown file:
           0 (backtrace #<undefined>)

Sorry, I caught an exception
Backtrace:
          11 (apply-smob/1 #<catch-closure 1c73220>)
          10 (apply-smob/1 #<catch-closure 1c73120>)
In ice-9/boot-9.scm:
   2312:4  9 (save-module-excursion #<procedure 1c77c20 at ice-9/eva…>)
In ice-9/eval-string.scm:
     38:6  8 (read-and-eval #<input: string 1d8e5b0> #:lang _)
In ice-9/boot-9.scm:
    841:4  7 (with-throw-handler _ _ _)
In opencog/nlp/chatbot/bot-api.scm:
    39:35  6 (_)
In opencog/nlp/chatbot/chat-utils.scm:
    182:8  5 (nlp-parse "Help")
In srfi/srfi-1.scm:
    640:9  4 (for-each #<procedure 7f0d43957868 at opencog/nlp/proc…> …)
In opencog/nlp/processing-utils.scm:
    57:18  3 (_ _)
In ice-9/boot-9.scm:
   752:25  2 (dispatch-exception _ _ _)
   751:25  1 (dispatch-exception 1 unbound-variable ("module-look…" …))
In unknown file:
           0 (apply-smob/1 #<catch-closure 1c730e0> unbound-variable …)

ERROR: In procedure apply-smob/1:
In procedure module-lookup: Unbound variable: cog-extract-recursive
ABORT: unbound-variable
 (/home/ubuntu/home/atomspace/opencog/cython/opencog/PyScheme.cc:63)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 353, in process_update
    self.dispatch_error(update, e)
  File "/usr/local/lib/python3.6/dist-packages/telegram/ext/dispatcher.py", line 524, in dispatch_error
    callback(self.bot, update, error)
TypeError: error() takes 2 positional arguments but 3 were given

from opencog.

linas avatar linas commented on June 9, 2024

Try cog-extract-recursive! with the exclamation mark at the end. I think it's needed. There is a backward-compatibility layer, without the exclamation mark, but perhaps it is not being loaded for some opaque reason. I will submit a pull request shortly.

Also, could someone please submit a pull req to patch up the telegram-bot?

from opencog.

aivanouski avatar aivanouski commented on June 9, 2024

I have fixed it by adding next config in python script:
scheme_eval(atomspace, '(primitive-load "/home/ubuntu/home/atomspace/opencog/scm/opencog.scm")')

from opencog.

aivanouski avatar aivanouski commented on June 9, 2024

After next dialog:

  • Tom eats apples.
  • Hello Andrei, you said: "Tom eats apples."
    You made a Declarative SpeechAct
  • What does Tome eat?

It catch exception, In unknown file:
3 (opencog-extension cached-sureal-match (#))


RuntimeError: Python-Scheme Wrapper: Failed to execute '(process-query "Andrei" "What does Tome eat?")'
Hello Andrei, you said: "What does Tome eat?"
You made an Interrogative SpeechAct

Backtrace:
          19 (apply-smob/1 #<catch-closure 17893c0>)
          18 (apply-smob/1 #<catch-closure 17892c0>)
In ice-9/boot-9.scm:
   2312:4 17 (save-module-excursion #<procedure 178d860 at ice-9/eva…>)
In ice-9/eval-string.scm:
     38:6 16 (read-and-eval #<input: string 1489d90> #:lang _)
In ice-9/boot-9.scm:
    841:4 15 (with-throw-handler _ _ _)
In opencog/nlp/chatbot/bot-api.scm:
    19:17 14 (wh_query_process _)
In opencog/nlp/fuzzy.scm:
   191:48 13 (get-fuzzy-answers _ #:do-microplanning _)
In srfi/srfi-1.scm:
   679:15 12 (append-map _ _ . _)
   592:17 11 (map1 (#))
In opencog/nlp/fuzzy.scm:
    74:27 10 (_ _)
In opencog/nlp/microplanning/main.scm:
   123:23  9 (microplanning-main # "declarative" #<<chunks-option> …> …)
    214:8  8 (make-sentence-chunks _ _ _)
In srfi/srfi-1.scm:
    640:9  7 (for-each #<procedure sub-helper (ut)> ("declarative"))
In opencog/nlp/microplanning/main.scm:
   158:32  6 (sub-helper "declarative")
   285:32  5 (make-sentence _ _ "declarative" #<<chunks-option> 1585…>)
   539:36  4 (check-chunk _ "declarative" _)
In unknown file:
           3 (opencog-extension cached-sureal-match (#))
In ice-9/boot-9.scm:
   751:25  2 (dispatch-exception 0 C++-EXCEPTION ("cached-sureal-…" …))
In opencog/nlp/chatbot/bot-api.scm:
    83:12  1 (_ . _)
In unknown file:
           0 (backtrace #<undefined>)

Sorry, I caught an exception
Backtrace:
          19 (apply-smob/1 #<catch-closure 17893c0>)
          18 (apply-smob/1 #<catch-closure 17892c0>)
In ice-9/boot-9.scm:
   2312:4 17 (save-module-excursion _)
In ice-9/eval-string.scm:
     38:6 16 (read-and-eval #<input: string 1489d90> #:lang _)
In ice-9/boot-9.scm:
    841:4 15 (with-throw-handler _ _ _)
In opencog/nlp/chatbot/bot-api.scm:
    19:17 14 (wh_query_process _)
In opencog/nlp/fuzzy.scm:
   191:48 13 (get-fuzzy-answers _ #:do-microplanning _)

Adding next config to script, doesn't help:

scheme_eval(atomspace, '(primitive-load "/home/ubuntu/home/opencog/opencog/nlp/sureal/surface-realization.scm")')

from opencog.

linas avatar linas commented on June 9, 2024
  1. you wrote "What does Tome eat?" - try again without the "e"
  2. the chatbot was very incomplete: if you look at bot-api.scm, it doesn't do much.
  3. the code that is crashing, somewhere in sureal, is also unmaintained.

Are you good at programming? You might try to find what it is in sureal that is throwing an exception ...

from opencog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.