FCG 中是否有处理未知单词的标准诊断?

Is there a standard diagnostic for handling unknown words in FCG?

我有英语的 FCG 语法,我正在解析一些包含词汇外单词的文本。此时此刻,我编写自己的定制诊断和修复。在最新的 FCG 版本中是否有处理未知单词的标准方法?

此时此刻,编写自己定制的诊断和修复确实是最好的解决方案。然而,在 FCG 的下一个版本中,将包含一个集成诊断和修复库。未知单词的单词大致如下所示:

用于检测未知单词的诊断(运行 创建每个节点后)

(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))))