Conversation
| sbj = match.first_match("NP-SUBJ") | ||
| if sbj is None: | ||
| return | ||
| if len(sbj) > 1: # TODO: more accurate subject selection |
There was a problem hiding this comment.
Can this ever happen, with first_match()?
There was a problem hiding this comment.
This check is used in similar cases multiple times in the script, would have to check further if it's necessary
| ) | ||
|
|
||
| def agreement_conj(self, match: SimpleTree) -> None: | ||
| vp = match.first_match("VP > (so_ft|so_et)") |
There was a problem hiding this comment.
Would be nice to have a comment here that describes exactly what this rule is correcting, preferably with an example.
| ) | ||
|
|
||
| def agreement_subpost_sing(self, match: SimpleTree) -> None: | ||
| vp = match.first_match("VP > (so_ft)") |
There was a problem hiding this comment.
Again, a comment would be useful.
There was a problem hiding this comment.
Are you using black for formatting? That line is 153 characters wide! :)
There was a problem hiding this comment.
I'm using black but for some reason it's not working on a part of this script. Fixed the wide lines I saw :)
| sbj = match.first_match("NP-SUBJ > { (no_nf_et|fn_nf_et) }") | ||
| if sbj is None: | ||
| return | ||
| if len(sbj) > 1: # TODO: more accurate subject selection |
There was a problem hiding this comment.
Can this ever happen, with first_match()?
There was a problem hiding this comment.
Again, would have to look further into this
| ) | ||
|
|
||
| def agreement_concord(self, match: SimpleTree) -> None: | ||
| np = match.first_match("NP") |
src/reynir_correct/pattern.py
Outdated
| def agreement_concord(self, match: SimpleTree) -> None: | ||
| np = match.first_match("NP") | ||
| # if vp is None: return | ||
| assert np is not None |
There was a problem hiding this comment.
Might be more robust to do an if...return, instead of assert().
|
|
||
| self.add_pattern( | ||
| ( | ||
| "þessi", # Trigger lemma for this pattern |
There was a problem hiding this comment.
This pattern doesn't make sense since it's triggered by 'þessi' in a possessive noun phrase, which probably wouldn't happen. It then calls agreement_conj() which relates to conjuctions like the ones here above. Maybe it would be best to delete this pattern.
| ) | ||
|
|
||
| def agreement_conj(self, match: SimpleTree) -> None: | ||
| vp = match.first_match("VP > (so_ft|so_et)") |
| sbj = match.first_match("NP-SUBJ") | ||
| if sbj is None: | ||
| return | ||
| if len(sbj) > 1: # TODO: more accurate subject selection |
There was a problem hiding this comment.
This check is used in similar cases multiple times in the script, would have to check further if it's necessary
| ) | ||
|
|
||
| def agreement_subpost_sing(self, match: SimpleTree) -> None: | ||
| vp = match.first_match("VP > (so_ft)") |
| sbj = match.first_match("NP-SUBJ > { (no_nf_et|fn_nf_et) }") | ||
| if sbj is None: | ||
| return | ||
| if len(sbj) > 1: # TODO: more accurate subject selection |
There was a problem hiding this comment.
Again, would have to look further into this
| ) | ||
|
|
||
| def agreement_concord(self, match: SimpleTree) -> None: | ||
| np = match.first_match("NP") |
src/reynir_correct/pattern.py
Outdated
| def agreement_concord(self, match: SimpleTree) -> None: | ||
| np = match.first_match("NP") | ||
| # if vp is None: return | ||
| assert np is not None |
|
|
||
| self.add_pattern( | ||
| ( | ||
| "þessi", # Trigger lemma for this pattern |
There was a problem hiding this comment.
This pattern doesn't make sense since it's triggered by 'þessi' in a possessive noun phrase, which probably wouldn't happen. It then calls agreement_conj() which relates to conjuctions like the ones here above. Maybe it would be best to delete this pattern.
| ) | ||
| ) | ||
|
|
||
| def agreement_subpost_sing(self, match: SimpleTree) -> None: |
There was a problem hiding this comment.
No pattern in the script triggers this function. Should I delete it or keep it in case a pattern will be added?
| ) | ||
| ) | ||
|
|
||
| def agreement_concord(self, match: SimpleTree) -> None: |
There was a problem hiding this comment.
Again, no pattern in the script triggers this function. Should I delete it or keep it in case a pattern will be added?
Handling for agreement errors added.