Skip to content

Commit 7ba6ea3

Browse files
Recognize "þess í stað" as a fixed adverbial phrase
The static phrase "þess í stað" was commented out in Phrases.conf, so the three tokens were analyzed separately ('þess' as a genitive object, 'í stað' as a prepositional phrase), which rarely fits the sentence; sentences such as "Þess í stað fór hann heim" or "Hann fór þess í stað að læra" did not parse. Enable the phrase, which then matches an 'ao' terminal like the other fixed adverbials. Measured on the unparsed-sentence corpus: 171 of 250 sentences with 'þess í stað' now parse. No change on 1000 previously parsed news sentences. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent f929431 commit 7ba6ea3

2 files changed

Lines changed: 19 additions & 1 deletion

File tree

src/reynir/config/Phrases.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ meaning = ao frasi -
13651365
# "þess efnis", "fahee nhee", "sá efni"
13661366
#"þess utan", "fphee ae", "það utan"
13671367
#"þess vegna", "fphee ae", "það vegna"
1368-
#"þess í stað", "fphee ao nkeo", "það í staður"
1368+
"þess í stað", "fphee ao nkeo", "það í staður"
13691369
"þvert á móti", "lhensf aa aa", "þver á móti"
13701370
"því miður", "fpheþ aam", "það lítt"
13711371
"fyrir slysni", "ao nveo", "fyrir slysni"

test/test_parse.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2746,6 +2746,23 @@ def test_quoted_question_attribution(r) -> None:
27462746
assert "VP so_0_gm_fh_et_p3 /VP sérnafn" in s.tree.flat
27472747

27482748

2749+
def test_thess_i_stad(r) -> None:
2750+
"""'þess í stað' is a fixed adverbial phrase"""
2751+
for sentence in (
2752+
"Þess í stað fór hann heim.",
2753+
"Hann fór þess í stað í bæinn.",
2754+
"Þess í stað hafi flugfélagið fengið leiguvélar.",
2755+
"Það er ekki rétt, þess í stað er loftinu hleypt úr dekkjunum.",
2756+
"Hann gaf upp ferilinn og fór þess í stað að læra.",
2757+
):
2758+
s = r.parse_single(sentence)
2759+
assert s and s.tree, sentence
2760+
assert any(
2761+
t.text.lower() == "þess í stað" and t.terminal == "ao"
2762+
for t in s.tree.leaves
2763+
), sentence
2764+
2765+
27492766
if __name__ == "__main__":
27502767
# When invoked as a main module, do a verbose test
27512768
from reynir import Greynir
@@ -2813,4 +2830,5 @@ def test_quoted_question_attribution(r) -> None:
28132830
test_verb_with_clitic_subject(g)
28142831
test_article_with_nominalized_adjective(g)
28152832
test_quoted_question_attribution(g)
2833+
test_thess_i_stad(g)
28162834
g.__class__.cleanup()

0 commit comments

Comments
 (0)