delph-in / erg

English Resource Grammar
MIT License
19 stars 3 forks source link

Rule names missing in LUI chart display after LKB parse #26

Closed john-a-carroll closed 1 year ago

john-a-carroll commented 3 years ago

Siew Yeng Chow reported an issue where after parsing with the LKB, the LUI parse chart shows BASIC_CTYPE instead of rule names: https://delphinqa.ling.washington.edu/t/getting-parse-chart-in-lkb/686

The issue is caused by a faulty definition of lui-chart-edge-name in lkb/user-fns.lsp . As I explained, the function should pick up RNAME from the original rule not the chart edge. Here's a fix:

(defun lui-chart-edge-name (edge)
  (let* ((rule (edge-rule edge))
         (rname
           (when (rule-p rule)
             (existing-dag-at-end-of 
               (tdfs-indef (rule-full-fs rule)) '(RNAME)))))
    (format nil "~a[~a]"
      (cond 
        ((not (edge-children edge)) 
          (let ((le (get-lex-entry-from-id (first (edge-lex-ids edge)))))
            (dag-type (tdfs-indef (lex-entry-full-fs le)))))
        (rname (dag-type rname))
        (t
          (tree-node-text-string (find-category-abb (edge-dag edge)))))
      (edge-id edge))))

This should work in all versions of the ERG and all versions of the LKB.

danflick commented 2 years ago

I have now added this patch to the 2020 release, and will propagate it in the trunk version of the ERG. Thanks.

danflick commented 1 year ago

Now also in the 2023 release.