kylebgorman / pynini

Read-only mirror of Pynini
http://pynini.opengrm.org
Apache License 2.0
118 stars 27 forks source link

Example for pynini.replace #39

Closed sairahul closed 3 years ago

sairahul commented 3 years ago

I am not sure if is the right place to ask. Could some one provide an example for pynini.replace ? The signature before 2.0.9 version looks straightforward. Its not clear how to use it now. There was an example in CHEATSHEET before 2.0.9, now it is removed and there is no example in test case as well. Is there any other function that replaces the same functionality ?

kylebgorman commented 3 years ago

The short answer is there aren't any good brief examples of it. It's just not very useful for grammar compilation, the point of this library, it's just in there because we try to expose all the lower-level bits just in case. (In the 150-page book we're writing on Pynini, it's not mentioned once.) Most of the things you do with it are better expressed as concatenations and unions. What do you want to use it for?

Here's something I came up with from the OpenFst docs, but as you see, an interesting example is pretty verbose and could be written much easier with pure concatenation and union.

https://gist.github.com/kylebgorman/74ae7d775392b31a1f46656915b50d1e

sairahul commented 3 years ago

Thanks for getting back Kyle . I am a beginner exploring the pynini. I started with your introduction paper and stuck on the replace function. The example you pointed is good enough. It's good to know that you are working on a book. Looking forward to reading it.

kylebgorman commented 3 years ago

(FYI the book will be released this summer from the publisher Morgan & Claypool. The working title is "Finite-State Text Processing".)

On Wed, Mar 31, 2021 at 12:53 AM sairahul @.***> wrote:

Thanks for getting back Kyle . I am a beginner exploring the pynini. I started with your introduction paper and stuck on the replace function. The example you pointed is good enough. It's good to know that you are working on a book. Looking forward to reading it.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/kylebgorman/pynini/issues/39#issuecomment-810759453, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABG4OIJJO76XC5GWXCTWELTGKTDLANCNFSM42DR3ADQ .