Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

cfg: other languages compatibility #48

Closed
nlpirate opened this issue Oct 7, 2022 · 6 comments
Closed

cfg: other languages compatibility #48

nlpirate opened this issue Oct 7, 2022 · 6 comments

Comments

@nlpirate
Copy link

nlpirate commented Oct 7, 2022

I am interested in some verticalization of lambeq (and consequently discocat) to languages other than English, particularly Italian. As far as I read from the documentation from a linguistic point of view, at the base of the framework, there are cfg grammars. I know this theoretical formalism very well. How is it possible to visualize and extract the structures and formalisms of these grammars from the library so that they can be extended/modified?

@chirico85
Copy link

Good point.
In my case German would be interesting.

@Thommy257
Copy link
Contributor

Thommy257 commented Feb 6, 2023

Hi @nlpirate and @chirico85,

Our parser works based on the Combinatory categorial grammar (CCG) formalism, which is a bit different to context-free grammar (CFG). While CFGs are generative, i.e produce valid sentences, CCG models are used to infer grammar trees from well-formed sentences. Hence, CCGs are parsable, which we leverage using our BobcatParser.

Bobcat works in two stages: First, we apply a BERT model to determine the most likely CCG types per word. The outcome of that step is a weighted list of the k most likely types. After that, we apply a deterministic chart parser that aims to find the most probable CCG reduction tree from the possible word types. You can read more about our parser here.

As you can see, we use a statistical model for the first step, which needs to be trained on data. The data we use to train Bobcat is the CCGbank, which is a translation from the Penn treebank. Hence, to support multiple languages, we need to have such CCG banks for each language, which might require a lot of work.

However, if you don't require a fully-comprehensive CCG parser, you can always create your own (deterministic) parser based on our abstract CCGParser class:

class CCGParser(Reader):

I hope this helps!

@Thommy257
Copy link
Contributor

Also, DisCoPy supports CFG grammars (https://docs.discopy.org/en/0.5/discopy/grammar.cfg.html?highlight=cfg#module-discopy.grammar.cfg), therefore CFGs are also supported by lambeq. Furthermore, CCGs can express CFGs, i.e. also be used to generate sentences.

@dimkart
Copy link
Contributor

dimkart commented Feb 8, 2023

I think there was an effort for creating an Italian CCGBank in the past (Turin univ.?) , not sure however what happened with that project.

@nlpirate
Copy link
Author

yes, indeed it exists and is available on the site (tut-ccg), but the annotation is different than the one used in lambeq

@nlpirate nlpirate reopened this Feb 12, 2023
@dimkart
Copy link
Contributor

dimkart commented Mar 16, 2023

Not sure if there is anything more to say here, since as @Thommy257 explained above, without an annotated corpus like CCGBank you can't train a statistical parser. However we are very much interested in adding to lambeq support for languages other than English (and we welcome any community work towards this goal), so this issue will be converted into a Discussion to stay alive.

@CQCL CQCL locked and limited conversation to collaborators Mar 16, 2023
@dimkart dimkart converted this issue into discussion #66 Mar 16, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants