GrammaticalFramework / gf-core

Grammatical Framework core: compiler, shell & runtimes
https://www.grammaticalframework.org
Other
129 stars 35 forks source link

PGF2 lacks some functions that are available in PGF #131

Open harisont opened 3 years ago

harisont commented 3 years ago

Using GF from Haskell I noticed that PGF2 lacks various maybe-not-indispensable-but-certainly-useful functions that were (well, are) available in PGF.

For instance, under Generation in PGF2 there is only one function generateAll, while under Generation in PGF there are lot of options for generating sentences from specific templates, choosing specific depths and so on. The same applies to other operations, such as linearization.

As PGF2 is more convenient for many things, and as using PGF and PGF2 together seems not to be the best way to use GF in Haskell development, I wonder: could these missing functions be easily added to PGF2, or are there specific reasons (like differences between the C and the Haskell runtime) why they have not been implemented?

krangelov commented 3 years ago

They were not added because no one needed them. In the C runtime, I focused on parsing and generation and other things were added as needed. Random generation for instance is mostly used for testing from the GF shell and that is why no one needed that in the C runtime.

With the new runtime there will be a new compiler which works only on top of the C runtime. This means that it would have to support random generation as well as other things that are currently missing.

On Tue, 17 Aug 2021 at 10:35, Arianna Masciolini @.***> wrote:

Using GF from Haskell I noticed that PGF2 lacks various maybe-not-indispensable-but-certainly-useful functions that were (well, are) available in PGF.

For instance, under Generation in PGF2 https://hackage.haskell.org/package/gf-3.10/docs/PGF2.html#g:14 there is only one function generateAll, while under Generation in PGF https://hackage.haskell.org/package/gf-3.10/docs/PGF.html#g:15 there are lot of options for generating sentences from specific templates, choosing specific depths and so on. The same applies to other operations, such as linearization.

As PGF2 is more convenient for many things, and as using PGF and PGF2 together seems not to be the best way to use GF in Haskell development, I wonder: could these missing functions be easily added to PGF2, or are there specific reasons (like differences between the C and the Haskell runtime) why they have not been implemented?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/GrammaticalFramework/gf-core/issues/131, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYFSZCY4NGFRBXORDMNBHDT5INOPANCNFSM5CJLKWOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

johnjcamilleri commented 3 years ago

I've been looking into how easy it would be to add some more generation functions to PGF2, for example generateFrom for generation from an expression template. I see there is no ready-to-use function in the C runtime for this, but could it be added relatively easily using the existing 'reasoner' code? Or would you say it requires some significant additions to support this?

krangelov commented 3 years ago

The reasoner code supports only exhaustive generation and would not be easy to adapt for random generation. I don't know what you really want.

Another option is to just adapt the generation code from the Haskell runtime. After all, the only primitive that you need for the generation is the function functionsByCat which is in the API.

On Tue, 24 Aug 2021 at 10:58, John J. Camilleri @.***> wrote:

I've been looking into how easy it would be to add some more generation functions to PGF2, for example generateFrom for generation from an expression template. I see there is no ready-to-use function in the C runtime for this, but could it be added relatively easily using the existing 'reasoner' code? Or would you say it requires some significant additions to support this?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/GrammaticalFramework/gf-core/issues/131#issuecomment-904457676, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEYFSZHIQV52Q67DJWE3AADT6NNMHANCNFSM5CJLKWOA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

johnjcamilleri commented 3 years ago

The reasoner code supports only exhaustive generation and would not be easy to adapt for random generation.

Well I meant exhaustive generation from a template, as in:

> gt Pred (This ?) Boring
Pred (This Cheese) Boring
Pred (This Fish) Boring
...

Another option is to just adapt the generation code from the Haskell runtime. After all, the only primitive that you need for the generation is the function functionsByCat which is in the API.

Right, I did not think of this. Thanks!