SBCL -Common Lisp错误

时间:2017-08-03 04:28:18

标签: lisp common-lisp

我正在尝试从以下链接运行存储库:
https://github.com/JafferWilson/test-program

我收到此错误:

sbcl --script paraphrasing.lisp 
Unhandled SB-KERNEL:SIMPLE-PACKAGE-ERROR in thread #<SB-THREAD:THREAD
                                                     "main thread" RUNNING
                                                      {100399C6D3}>:
  The name "USER" does not designate any package.

Backtrace for: #<SB-THREAD:THREAD "main thread" RUNNING {100399C6D3}>
0: ((LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX))
1: (SB-IMPL::CALL-WITH-SANE-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX) {10039E3C1B}>)
2: (SB-IMPL::%WITH-STANDARD-IO-SYNTAX #<CLOSURE (LAMBDA NIL :IN SB-DEBUG::FUNCALL-WITH-DEBUG-IO-SYNTAX) {10039E3BEB}>)
3: (PRINT-BACKTRACE :STREAM #<SB-SYS:FD-STREAM for "standard error" {10039A22B3}> :START 0 :FROM :INTERRUPTED-FRAME :COUNT NIL :PRINT-THREAD T :PRINT-FRAME-SOURCE NIL :METHOD-FRAME-STYLE NIL)
4: (SB-DEBUG::DEBUGGER-DISABLED-HOOK #<SB-KERNEL:SIMPLE-PACKAGE-ERROR "The name ~S does not designate any package." {10039E1643}> #<unavailable argument>)
5: (SB-DEBUG::RUN-HOOK *INVOKE-DEBUGGER-HOOK* #<SB-KERNEL:SIMPLE-PACKAGE-ERROR "The name ~S does not designate any package." {10039E1643}>)
6: (INVOKE-DEBUGGER #<SB-KERNEL:SIMPLE-PACKAGE-ERROR "The name ~S does not designate any package." {10039E1643}>)
7: (ERROR SB-KERNEL:SIMPLE-PACKAGE-ERROR :PACKAGE "USER" :FORMAT-CONTROL "The name ~S does not designate any package." :FORMAT-ARGUMENTS ("USER"))
8: (SB-INT:%FIND-PACKAGE-OR-LOSE "USER")
9: (SB-INT:FIND-UNDELETED-PACKAGE-OR-LOSE "USER")
10: ((LAMBDA NIL :IN "/home/aims/paraphrasing/paraphrasing.lisp"))
11: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SETQ *PACKAGE* (SB-INT:FIND-UNDELETED-PACKAGE-OR-LOSE "USER")) #<NULL-LEXENV>)
12: (SB-INT:SIMPLE-EVAL-IN-LEXENV (IN-PACKAGE "USER") #<NULL-LEXENV>)
13: (EVAL-TLF (IN-PACKAGE "USER") 0 NIL)
14: ((LABELS SB-FASL::EVAL-FORM :IN SB-INT:LOAD-AS-SOURCE) (IN-PACKAGE "USER") 0)
15: ((LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KEYS) :IN SB-INT:LOAD-AS-SOURCE) (IN-PACKAGE "USER") :CURRENT-INDEX 0)
16: (SB-C::%DO-FORMS-FROM-INFO #<CLOSURE (LAMBDA (SB-KERNEL:FORM &KEY :CURRENT-INDEX &ALLOW-OTHER-KEYS) :IN SB-INT:LOAD-AS-SOURCE) {10039A7ECB}> #<SB-C::SOURCE-INFO {10039A7E83}> SB-C::INPUT-ERROR-IN-LOAD)
17: (SB-INT:LOAD-AS-SOURCE #<SB-SYS:FD-STREAM for "file /home/aims/paraphrasing/paraphrasing.lisp" {10039A4703}> :VERBOSE NIL :PRINT NIL :CONTEXT "loading")
18: ((FLET SB-FASL::LOAD-STREAM :IN LOAD) #<SB-SYS:FD-STREAM for "file /home/aims/paraphrasing/paraphrasing.lisp" {10039A4703}> NIL)
19: (LOAD #<SB-SYS:FD-STREAM for "file /home/aims/paraphrasing/paraphrasing.lisp" {10039A4703}> :VERBOSE NIL :PRINT NIL :IF-DOES-NOT-EXIST T :EXTERNAL-FORMAT :DEFAULT)
20: ((FLET SB-IMPL::LOAD-SCRIPT :IN SB-IMPL::PROCESS-SCRIPT) #<SB-SYS:FD-STREAM for "file /home/aims/paraphrasing/paraphrasing.lisp" {10039A4703}>)
21: ((FLET #:WITHOUT-INTERRUPTS-BODY-146 :IN SB-IMPL::PROCESS-SCRIPT))
22: (SB-IMPL::PROCESS-SCRIPT "paraphrasing.lisp")
23: (SB-IMPL::TOPLEVEL-INIT)
24: ((FLET #:WITHOUT-INTERRUPTS-BODY-82 :IN SAVE-LISP-AND-DIE))
25: ((LABELS SB-IMPL::RESTART-LISP :IN SAVE-LISP-AND-DIE))

unhandled condition in --disable-debugger mode, quitting

请帮助我解决这个问题,以便程序有效运行。

1 个答案:

答案 0 :(得分:4)

对于SBCL:

创建一个包并仅使用包COMMON-LISP:

(defpackage "PARAPHRASING"
  (:use "COMMON-LISP"))

(in-package "PARAPHRASING")

用DEFPARAMETER替换所有DEFCONSTANT定义列表

(defparameter +bad-single-pos-paraphrasings+
  (mapcar #'intern '("TO" "DT" "CC" "IN" "WDT" "POS" "PRP")))
(defparameter +input-paren-types+
  (list (list "[[" (intern "NN")) (list "((" (intern "VB"))))
;; Stuff with no alphabetic chars is ignored in any case
(defparameter +auxiliaries+ (mapcar #'intern '("DT" "IN" "TO")))
;; Lengths taken for rules
(defparameter +context-lens+ '(1))

确保使用NREVERSE的返回值

(defun extract-paraphrases1 (pair rule)
  (labels (;; Find all positions where prfx is in seq.
           (find-prefix-positions (prfx seq)
             (if (null (first prfx))
               ;; Must be at the beginning.
               (and (pos-match-prefix (rest prfx) seq) (list -1))
               (pos-sub-positions prfx seq)))
           ;; Find all positions where sffx is in seq - after some point.
           (find-suffix-positions (skip sffx seq)
             (let ((lst (nthcdr skip seq)))
               (if (null (first sffx))
                 ;; a trick - nreverse both lists, not expensive
                 (let* ((slen (length (rest sffx)))
                        (sffx (nreverse (rest sffx)))
                        (lst  (nreverse lst))
                        (m?   (pos-match-prefix sffx lst)))
                   ;; restore things
                   (setf sffx (nreverse sffx))  ; <- use the result
                   (setf lst (nreverse lst))    ; <- use the result
 ...

<强> INTERN

对INTERN的所有调用都应使用包名"PARAPHRASING"作为第二个参数。这样,符号总是在正确的包中创建。

使用

* (paraphrasing::co-train "20000leagues-tagged-pairs-roots.txt")
Reading input...
Done, 6275 sentences read.
========== Iteration #1/10 ==========
Learning context rules...
  ...6250 left
  ...6000 left

...