Open
Conversation
gsvgit
requested changes
Dec 9, 2024
Member
gsvgit
left a comment
There was a problem hiding this comment.
All docstrings should be updated too.
| @@ -41,7 +41,7 @@ def test_production_rules(self): | |||
| """ Tests the production rules """ | |||
| produ = ProductionRule("S", "C", "end") | |||
pyformlang/indexed_grammar/utils.py
Outdated
| from typing import Callable, List, Set, Iterable, Any | ||
|
|
||
|
|
||
| def exists(list_elements: List[Any], |
Member
There was a problem hiding this comment.
Is it any(map(predicate, iterable)) ? As I know, map returns enumerator, not list, so this version should be more or less optimal.
|
|
||
| Returns | ||
| --------- | ||
| right_terms : iterable of any |
| is_duplication : bool | ||
| Whether the rule is a duplication rule or not | ||
| --------- | ||
| left_term : any |
| def non_terminals(self) -> Set[Variable]: | ||
| """Gets the non-terminals used in the rule | ||
|
|
||
| non_terminals : iterable of any |
| def left_term(self) -> Variable: | ||
| """Gets the symbol on the left of the rule | ||
|
|
||
| left : any |
| def states(self) -> Set[State]: | ||
| """ Get the states of the FST | ||
|
|
||
| Returns |
548fc06 to
32963bd
Compare
gsvgit
reviewed
Feb 13, 2025
|
|
||
| Returns | ||
| ---------- | ||
| terminals : iterable of any |
Member
There was a problem hiding this comment.
Type is inconsistent with type annotation.
| -> Tuple[bool, bool]: | ||
| """Processes a duplication rule | ||
|
|
||
| Parameters |
Member
There was a problem hiding this comment.
Type is inconsistent with type annotation
| def __and__(self, other: FST) -> "IndexedGrammar": | ||
| """ Computes the intersection of the current indexed grammar with the | ||
| other object | ||
|
|
Member
There was a problem hiding this comment.
Type is inconsistent with type annotation
1dddebb to
e63bd9d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rework the remaining modules:
fstandindexed_grammar. Use existing object representations for better typing, remove import cycles by refactoring the intersection methods. Add pyright type checker to requirements, update CI config by adding type checking jobs. Also split CI into different workflows to make the configuration clearer.Changes by module:
indexed_grammar:IndexedGrammarfromFST.FSTexplicitly.utilsfile to contain nontrivial indexed grammar utility.fst:FSTby using finite automata object representations.FSTto make it similar to the other classes.TransitionFunctionclass.utilsfile.