question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Transformer interface and behavior change in 0.6.0

See original GitHub issue

Hi !

I was wondering: why did the interface for Transformer methods change ?

I used to have:

class MyTransformer(Transformer_NoRecuse):
    def some_rule(self, tree: Tree):
        tree.children = [...]    # Some changes on children + access to tree class
        return tree

Now, when converting to Transformer_InPlace), I’m bothered by the fact that a function rule will delete the tree. e.g.

class MyTransformer(Transformer_InPlace):
    def some_rule(self, values: List):
        values = [...]    # Some changes on values + no access to tree class :(
        return values   # <- In the final tree, the `some_rule` node has disappeared !

I can update my code to the new Transformer_InPlace with many changes but having access to the tree and a way to rewrite portions and/or delete the tree element gave more flexibility in the usage. What is the rationale behind removing trees in arguments to transformer functions ? Is there a way to have access to the tree in each transformer functions ?

Thanks for the wonderful work you’re doing on lark 😃

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
erezshcommented, Jul 23, 2018

Actually, having looked at both, I think MkDocs is probably better for Lark, because

  1. It uses Markdown, which is simpler, and it’s what the existing documentation uses

  2. It has nicer default themes

0reactions
achedeuzotcommented, Jul 23, 2018

I’ve used Sphinx in the past and it was straightforward to set up and use.

There’s good documentation here: http://dont-be-afraid-to-commit.readthedocs.io/en/latest/documentation.html

Would you want me to suggest a pull-request for this ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installation Error - Failed building wheel for tokenizers #2831
Before running the installation edit transformers/setup.py and change requirement of tokenizers to 0.6.0. Line 93: install_requires=[
Read more >
We released a new version of ShapeShift (0.6.0) - Reddit
We released a new version of ShapeShift (0.6.0) - A lightweight, modular, performant and extensible object mapping library.
Read more >
Changelog — sktime documentation
This will change how classification safety decisions are made and returned, see BaseEarlyClassifier or TEASER for the new interface.
Read more >
deepsparse Changelog - pyup.io
Changes : * The behavior of the Multi-stream scheduler is now identical to the Elastic scheduler, and the old Multi-stream scheduler has been...
Read more >
Joris Van den Bossche: Home
Short summary: the upcoming 0.6.0 release of GeoPandas will feature a refactor based on the pandas ExtensionArray interface. Although this change should keep ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found