Skip to content

Commit 4962ea3

Browse files
committed
fixing tests
1 parent 8555198 commit 4962ea3

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/hyperbase_parser_ab/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def __init__(
169169
self,
170170
lang: str,
171171
beta: str = "repair",
172-
normalize: bool = True,
172+
normalise: bool = True,
173173
post_process: bool = True,
174174
debug: bool = False,
175175
) -> None:
@@ -203,7 +203,7 @@ def __init__(
203203
self.rules = repair_rules
204204
else:
205205
raise RuntimeError(f"unkown beta stage: {beta}")
206-
self.normalize: bool = normalize
206+
self.normalise: bool = normalise
207207
self.post_process: bool = post_process
208208
self.debug: bool = debug
209209

@@ -269,7 +269,7 @@ def parse_spacy_sentence(
269269
edge = self._apply_arg_roles(edge)
270270
if self.beta == "repair":
271271
edge = self._repair(edge)
272-
if self.normalize:
272+
if self.normalise:
273273
edge = self._normalise(edge)
274274
if self.post_process:
275275
edge = self._post_process(edge)

tests/test_parser.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def _make_parser(beta="repair"):
4646
patch("hyperbase_parser_ab.parser.Alpha"),
4747
):
4848
parser = AlphaBetaParser(
49-
"en", beta=beta, normalize=True, post_process=True, debug=False
49+
"en", beta=beta, normalise=True, post_process=True, debug=False
5050
)
5151
return parser
5252

@@ -55,7 +55,7 @@ class TestParserConfig:
5555
def test_default_config(self):
5656
parser = _make_parser()
5757
assert parser.lang == "en"
58-
assert parser.normalize is True
58+
assert parser.normalise is True
5959
assert parser.post_process is True
6060
assert parser.debug is False
6161
assert parser.beta == "repair"
@@ -69,28 +69,28 @@ def test_strict_mode(self):
6969
assert parser.rules is strict_rules
7070

7171

72-
class TestParserNormalize:
73-
def test_normalize_modifier_on_predicate(self):
72+
class TestParsernormalise:
73+
def test_normalise_modifier_on_predicate(self):
7474
"""When a modifier wraps a predicate relation, move modifier to inner connector."""
7575
parser = _make_parser()
7676
# (M (P C C)) should become ((M P) C C)
7777
edge = hedge("(quickly/M (runs/Pd/en cat/Cc/en dog/Cc/en))")
78-
result = parser._normalize(edge)
78+
result = parser._normalise(edge)
7979
assert result
8080
# The modifier should be merged with the inner predicate connector
8181
assert result[0].not_atom # connector should be (quickly/M runs/Pd/en)
8282
assert str(result[0][0]) == "quickly/M"
8383
assert str(result[0][1]) == "runs/Pd/en"
8484

85-
def test_normalize_atom_unchanged(self):
85+
def test_normalise_atom_unchanged(self):
8686
parser = _make_parser()
8787
atom = hedge("cat/Cc/en")
88-
assert parser._normalize(atom) == atom
88+
assert parser._normalise(atom) == atom
8989

90-
def test_normalize_non_modifier_unchanged(self):
90+
def test_normalise_non_modifier_unchanged(self):
9191
parser = _make_parser()
9292
edge = hedge("(runs/Pd/en cat/Cc/en dog/Cc/en)")
93-
result = parser._normalize(edge)
93+
result = parser._normalise(edge)
9494
assert result == edge
9595

9696

0 commit comments

Comments
 (0)