@@ -10,10 +10,6 @@ class MGNode:
1010 def lemma_string (self ) -> str :
1111 """Format the node as a string in a tree if leaf or trace"""
1212
13- def __str__ (self ) -> str : ...
14- def __eq__ (self , other : object ) -> bool : ...
15- def __hash__ (self ) -> int : ...
16-
1713class MGEdge :
1814 def is_move (self ) -> bool :
1915 """Checks whether the edge is a movement edge"""
@@ -22,10 +18,6 @@ class MGEdge:
2218 def move_edge () -> MGEdge :
2319 """Gets a movement edge"""
2420
25- def __str__ (self ) -> str : ...
26- def __eq__ (self , other : object ) -> bool : ...
27- def __hash__ (self ) -> int : ...
28-
2921class SyntacticStructure :
3022 """A parse tree for some string"""
3123
@@ -36,7 +28,7 @@ class SyntacticStructure:
3628 def contains_lexical_entry (self , s : str ) -> bool :
3729 """Check if this structure contains a specific lexical entry (formatted as an MG entry, will raise an error if unparseable)"""
3830
39- def contains_word (self , s : Optional [ str ] ) -> bool :
31+ def contains_word (self , s : str | None ) -> bool :
4032 """Check if this structure contains a specific word."""
4133
4234 def prob (self ) -> float :
@@ -51,9 +43,6 @@ class SyntacticStructure:
5143 def __to_tree_inner (
5244 self ,
5345 ) -> tuple [list [tuple [int , MGNode ]], list [tuple [int , int , MGEdge ]], int ]: ...
54- def __str__ (self ) -> str : ...
55- def __eq__ (self , other : object ) -> bool : ...
56- def __hash__ (self ) -> int : ...
5746
5847class Continuation :
5948 """A continuation of a prefix string"""
@@ -70,11 +59,7 @@ class Continuation:
7059 def is_multi_word (self ) -> bool :
7160 """Check if the continuation is an affixed word"""
7261
73- def __str__ (self ) -> str : ...
74- def __eq__ (self , other : object ) -> bool : ...
75- def __hash__ (self ) -> int : ...
76-
77- class GrammarIterator (Iterator [SyntacticStructure ]):
62+ class GrammarIterator :
7863 def __iter__ (self ) -> GrammarIterator : ...
7964 def __next__ (self ) -> SyntacticStructure : ...
8065
@@ -93,11 +78,11 @@ class Lexicon:
9378 self ,
9479 prefix : str ,
9580 category : str ,
96- min_log_prob : float = - 128.0 ,
81+ min_log_prob : float | None = - 128.0 ,
9782 move_prob : float = 0.5 ,
98- max_steps : int = 64 ,
99- n_beams : int = 256 ,
100- max_strings : Optional [ int ] = None ,
83+ max_steps : int | None = 64 ,
84+ n_beams : int | None = 256 ,
85+ max_strings : int | None = None ,
10186 ) -> set [Continuation ]:
10287 """Returns a set of all valid continuations from this prefix"""
10388
@@ -106,37 +91,33 @@ class Lexicon:
10691 category : str ,
10792 min_log_prob : float = - 128.0 ,
10893 move_prob : float = 0.5 ,
109- max_steps : int = 64 ,
110- n_beams : int = 256 ,
111- max_strings : Optional [ int ] = None ,
94+ max_steps : int | None = 64 ,
95+ n_beams : int | None = 256 ,
96+ max_strings : int | None = None ,
11297 ) -> list [tuple [list [str ], float ]]:
11398 """Returns a list of all unique strings and their probabilities"""
11499
115100 def generate_grammar (
116101 self ,
117102 category : str ,
118- min_log_prob : float = - 128.0 ,
103+ min_log_prob : float | None = - 128.0 ,
119104 move_prob : float = 0.5 ,
120- max_steps : int = 64 ,
121- n_beams : int = 256 ,
122- max_strings : Optional [ int ] = None ,
105+ max_steps : int | None = 64 ,
106+ n_beams : int | None = 256 ,
107+ max_strings : int | None = None ,
123108 ) -> GrammarIterator :
124109 """Returns an iterator over all possible parses"""
125110
126111 def parse (
127112 self ,
128113 s : str ,
129114 category : str ,
130- min_log_prob : float = - 128.0 ,
115+ min_log_prob : float | None = - 128.0 ,
131116 move_prob : float = 0.5 ,
132- max_steps : int = 64 ,
133- n_beams : int = 256 ,
134- max_strings : Optional [ int ] = None ,
117+ max_steps : int | None = 64 ,
118+ n_beams : int | None = 256 ,
119+ max_strings : int | None = None ,
135120 ) -> list [SyntacticStructure ]:
136121 """Returns a list of all possible parses of that string.
137122 The string, s, should be delimited by spaces for words and hyphens for multi-word expressions from head-movement
138123 """
139-
140- def __str__ (self ) -> str : ...
141- def __eq__ (self , other : object ) -> bool : ...
142- def __hash__ (self ) -> int : ...
0 commit comments