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

BobCat fails to parse with extra addition of "the" to a sentence. #121

Closed
abuzomol opened this issue Oct 2, 2023 · 2 comments
Closed

BobCat fails to parse with extra addition of "the" to a sentence. #121

abuzomol opened this issue Oct 2, 2023 · 2 comments

Comments

@abuzomol
Copy link

abuzomol commented Oct 2, 2023

I have been trying run this code:

import warnings
warnings.filterwarnings("ignore")
import os
os.environ["TOKENIZERS_PARALLELISM"] = "false"

from discopy.grammar.pregroup import Spider, Ty, Id, Box, Diagram, Word
from lambeq import DepCCGParser, pregroups

from lambeq import TreeReader, TreeReaderMode

reader = TreeReader(mode=TreeReaderMode.RULE_ONLY)

sent = "Avoiding processed and sugary foods is important for reducing the risk of chronic diseases such as diabetes , obesity , and heart disease ."

tree_diagram = reader.sentence2diagram(sent,suppress_exceptions=False)
print(tree_diagram)

which gives the error: Illegal use of UNK: unknown CCG rule.

However, if we run the same program with the following sentence after removing "the", it runs succesffuly.

...
sent = "Avoiding processed and sugary foods is important for reducing risk of chronic diseases such as diabetes , obesity , and heart disease ."
...

My attempt to debug the issue has reached a point where the conjunction in "and sugary food" was causing the error by having mismtach CCGRule type in "call" function in CCGRule class. Not sure why this is happening and how to solve it. Any ideas?

Thanks!

@dimkart
Copy link
Contributor

dimkart commented Oct 3, 2023

Hi @abuzomol and thanks for spotting this. There is indeed an issue in Bobcat, which seems it's missing a translation for a special case of conjunction. We will look at this and fix it soon.

@dimkart
Copy link
Contributor

dimkart commented Jan 16, 2024

This is now fixed in version 0.4. The issue will be closed.

@dimkart dimkart closed this as completed Jan 16, 2024
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

2 participants