Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Nlp 是否有处理FCG中未知单词的标准诊断?_Nlp_Grammar - Fatal编程技术网

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

Nlp 是否有处理FCG中未知单词的标准诊断?,nlp,grammar,Nlp,Grammar,我有一个FCG英语语法,我正在解析一些没有词汇的文本。此时此刻,我编写了自己的定制诊断和修复。在最新的FCG版本中,有没有处理未知单词的标准方法?目前,编写自己的定制诊断和修复确实是最好的解决方案。但是,在FCG的下一版本中,将包括一个集成诊断和维修库。用于未知单词的选项大致如下所示: 用于检测未知单词的诊断(在创建每个节点后运行) 修复添加新的词汇结构(当然非常通用,您需要根据自己的语法对其进行自定义): (defmethod repair((repair add词法cxn) (问题未知词)

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

目前,编写自己的定制诊断和修复确实是最好的解决方案。但是,在FCG的下一版本中,将包括一个集成诊断和维修库。用于未知单词的选项大致如下所示:

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

修复添加新的词汇结构(当然非常通用,您需要根据自己的语法对其进行自定义):

(defmethod repair((repair add词法cxn)
(问题未知词)
(节点cip节点)
&键(允许使用其他键(&A))
“通过为第一个未处理的字符串创建新的词法结构进行修复”
(let((uw(第一个(获取数据问题字符串)))
(多值绑定(cxn集合)
(eval`(def fcg cxn,(make symbol(字符串附加uw“-cxn”))
单词单位
(args(?ref))
(综合类(法律类?法律类))
(sem类别(sem类别?sem类别)))
(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))))