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

Fix: sample with index number #45

Open
Bubobubobubobubo opened this issue May 6, 2023 · 0 comments
Open

Fix: sample with index number #45

Bubobubobubobubo opened this issue May 6, 2023 · 0 comments

Comments

@Bubobubobubobubo
Copy link
Contributor

bd plays a sound but bd:2 does not play anything. You can investigate the issue by printing part of the tree as an expression is being evaluated by the mini-notation:

def visit_word_with_index(self, _node, children):
    word, index = children
    print(word, index)
    index = 0 if isinstance(index, Node) else index[0]
    return dict(type="word", value=word, index=index)

And then you'll see:

>>> s('bd')
bd <Node matching "">
~[((0, 1), (0, 1), {'s': 'bd'})] ...~
>>> s('bd:2')
bd [2]
bd <Node matching "">
~[((0, 1), (0, 1), {'s': {'n': 2, 's': 'bd'}})] ...~

Any ideas? I'm learning parsimonious to try to fix the issue.

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

1 participant