-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Vocabulary interface missing an iterable or equivalent method #904
Comments
💡 |
I agree that we should have a way to iterate or get the list but I don't think we can change the interface unless we make a major version, such as 4.6 but I'm heading to 4.5.1 shortly. @sharwell do you have a suggestion for an enhancement to the interface? |
We can certainly update the As for the specific API, I'm not sure yet because |
ha! I just needed this myself. On Sat, Jun 20, 2015 at 2:54 PM, GRosenberg notifications@github.com
Dictation in use. Please excuse homophones, malapropisms, and nonsense. |
Same problem here. I have
I would probably go for the last proposed suggestion as it the most flexible and elegant one. I can draft the required code changes and submit a pull request, if desired. |
Seems like getTokenCount() would be enough; only EOF is -1 and we could specify that as a special case. Or maybe getMaxTokenType() as there is no requirement that all token types are used. getSymbolicNames() would also be dang convenient. Can methods be added to an interface and be binary compatible with code that currently refs the interface? |
Yes, they are compatible (I checked with a quick test). While an Alternative approach: a triple that contains symbolic, literal and display name and an |
Depreciation of Recognizer.getTokenNames() presently leaves no equivalent or convenient method to iterate over the valid set of symbolic token names. Since the underlying String[] is now private, cannot iterate based on size.
Adding a Vocabulary.getSymbolicNames() method, returning a String[], would be helpful.
The text was updated successfully, but these errors were encountered: