Skip to content

Commit 6b70bf9

Browse files
committed
implement symbols
1 parent 3d632d9 commit 6b70bf9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

grape/automaton/tree_automaton.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ def size(self) -> int:
6868
"""
6969
return len(self.rules)
7070

71+
def symbols(self) -> int:
72+
"""
73+
Return the number of symbols of the DFTA which is a proxy for memory size.
74+
THis does not count letters.
75+
"""
76+
return sum(len(args) + 1 for _, args in self.rules.keys())
77+
7178
@property
7279
def states(self) -> Set[U]:
7380
"""

0 commit comments

Comments
 (0)