Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

normalize-fd apparently unused and not like the manual #1

Open
itegebo opened this issue Mar 26, 2018 · 2 comments
Open

normalize-fd apparently unused and not like the manual #1

itegebo opened this issue Mar 26, 2018 · 2 comments

Comments

@itegebo
Copy link

itegebo commented Mar 26, 2018

I understand the manual hasn't been updated in a while (as noted in release notes). Still, I'm trying to use it. The description of normalize-fd doesn't work as expected:

 (normalize-fd '((a ((a1 1)))
                (a ((alt (((a1 2))
                          ((a2 2))))))
                (a nil)
                ({a a3} 3)))
; Debugger entered on #<TYPE-ERROR expected-type: LIST datum: :I>

After poking around a bit, it seems like the following is closer to what was meant (for that example fd):

(filter-flags (u-disjunctions '((a ((a1 1)))
                (a ((alt (((a1 2))
                          ((a2 2))))))
                (a nil)
                ({a a3} 3)) nil))
((A ((A1 1) (A2 2) (A3 3))))

I was unable to find any usages of normalize-fd (in the code base) with which to better understand its meaning. It seems one may need different normalization functions for input and grammar fd's:

(filter-flags (u-disjunctions (get-test 'ir01) nil))
((CAT S) (PROT ((N ===))) (VERB ((V ===))) (GOAL ((N ===))))

So the previous method doesn't work so well on that input fd. But prep-input2 does:

(prep-input2 (get-test 'ir01))
((CAT S) (PROT ((N ((LEX "John"))))) (VERB ((V ((LEX "like")))))
 (GOAL ((N ((LEX "Mary"))))))

But then prep-input2 doesn't work well on the previous grammar-like fd:

(prep-input2 '((a ((a1 1)))
                (a ((alt (((a1 2))
                          ((a2 2))))))
                (a nil)
                ({a a3} 3)))
; Debugger entered on #<TYPE-ERROR expected-type: LIST datum: :I>
@itegebo
Copy link
Author

itegebo commented May 23, 2018

Also see appendix D.4, "Limits on Disjunctions in Input". This clarifies the situation a bit. Still, it seems like the behavior of normalize-fd changed since 5.2 wrt flags, resulting in the type errors I encountered.

@itegebo
Copy link
Author

itegebo commented May 24, 2018

I should have used the actual example input FD from the manual. When you do, normalize-fd returns NIL. However, if you swap the parameters in the call to u in the definition of normalize-fd, you'll get a non-NIL first value, but it won't be normalized. This may be moot because it appears prep-input2 is the real normalizer:

FUG5> (normalize-fd '((a ((a1 v1)))
            (b ((b1 w1)))
            (a ((a2 v2)))
            (b ((b2 ((w2 2)))))
            (b ((b2 ((w3 3)))))))
((A ((A1 V1))) (B ((B1 W1))) (A ((A2 V2))) (B ((B2 ((W2 2)))))
 (B ((B2 ((W3 3))))))
FUG5> (prep-input2 '((a ((a1 v1)))
            (b ((b1 w1)))
            (a ((a2 v2)))
            (b ((b2 ((w2 2)))))
            (b ((b2 ((w3 3)))))))
((A ((A1 V1) (A2 V2))) (B ((B1 W1) (B2 ((W2 2) (W3 3))))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant