2016-08-23 4 views

答えて

1

現在のところ、独自のカスタマイズされた診断と修復を作成することが最適なソリューションです。しかし、FCGの次のリリースでは、統合された診断と修復のライブラリが含まれます。未知語のための1つは、より多くのまたは次のようにそれほど見ます:未知語を検出するための

診断の非常に一般的な新しい語彙の建設を(追加するための

(defmethod diagnose ((diagnostic diagnose-unknown-words) (node cip-node) 
       &key &allow-other-keys) 
"Diagnose that the fully expanded structure contains untreated strings" 
(when (fully-expanded? node) 
(let ((strings-in-root (get-strings (assoc 'root 
              (left-pole-structure 
              (car-resulting-cfs (cipn-car node))))))) 
    (when strings-in-root 
    (let ((problem (make-instance 'unknown-words))) 
     (set-data problem 'strings strings-in-root) 
     problem))))) 

修理(すべてのノードの作成後に実行します)もちろん、あなた自身の文法にカスタマイズする必要があります):

(defmethod repair ((repair add-lexical-cxn) 
       (problem unknown-words) 
       (node cip-node) 
       &key &allow-other-keys) 
"Repair by making a new lexical construction for the first untreated string" 
(let ((uw (first (get-data problem 'strings)))) 
(multiple-value-bind (cxn-set lex-cxn) 
    (eval `(def-fcg-cxn ,(make-symbol (upcase (string-append uw "-cxn"))) 
         ((?word-unit 
          (args (?ref)) 
          (syn-cat (lex-class ?lex-class)) 
          (sem-cat (sem-class ?sem-class))) 
         <- 
         (?word-unit 
          (HASH meaning ((,(intern (upcase uw)) ?ref))) 
          -- 
          (HASH form ((string ?word-unit ,uw))))) 
         :cxn-inventory ,(copy-object (original-cxn-set (construction-inventory node))) 
         :cxn-set lex)) 
    (declare (ignore cxn-set)) 
    (make-instance 'fix 
       :repair repair 
       :problem problem 
       :restart-data lex-cxn))))