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

GrammaticalExpression _len_ does not return number of atoms / leaf nodes #42

Closed
nathimel opened this issue Jun 2, 2024 · 2 comments
Closed

Comments

@nathimel
Copy link
Collaborator

nathimel commented Jun 2, 2024

The len method for GrammaticalExpression returns the total number of nodes, but we typically report 'number of atoms' for complexity.

https://github.com/CLMBRs/ultk/blob/generic-meaning/src/ultk/language/grammar.py#L182

So having some way of getting just the leaf nodes would be good.

@shanest
Copy link
Collaborator

shanest commented Jun 5, 2024

Agreed! I kind of think __len__ should stay as it is, but we can easily add something like count_atoms. Do you think it should be a method in GrammaticalExpression or independent?

@nathimel
Copy link
Collaborator Author

nathimel commented Jun 5, 2024 via email

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

2 participants