Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agreement #61

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

Agreement #61

wants to merge 10 commits into from

Conversation

thorunna
Copy link
Collaborator

Handling for agreement errors added.

sbj = match.first_match("NP-SUBJ")
if sbj is None:
return
if len(sbj) > 1: # TODO: more accurate subject selection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this ever happen, with first_match()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is used in similar cases multiple times in the script, would have to check further if it's necessary

@@ -1707,6 +1707,90 @@ def né(self, match: SimpleTree) -> None:
)
)

def agreement_conj(self, match: SimpleTree) -> None:
vp = match.first_match("VP > (so_ft|so_et)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to have a comment here that describes exactly what this rule is correcting, preferably with an example.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

)

def agreement_subpost_sing(self, match: SimpleTree) -> None:
vp = match.first_match("VP > (so_ft)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, a comment would be useful.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you using black for formatting? That line is 153 characters wide! :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this ever happen, with first_match()?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, would have to look further into this

)

def agreement_concord(self, match: SimpleTree) -> None:
np = match.first_match("NP")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

def agreement_concord(self, match: SimpleTree) -> None:
np = match.first_match("NP")
# if vp is None: return
assert np is not None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be more robust to do an if...return, instead of assert().

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


self.add_pattern(
(
"þessi", # Trigger lemma for this pattern
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hvað með "sá"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@@ -1707,6 +1707,90 @@ def né(self, match: SimpleTree) -> None:
)
)

def agreement_conj(self, match: SimpleTree) -> None:
vp = match.first_match("VP > (so_ft|so_et)")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

sbj = match.first_match("NP-SUBJ")
if sbj is None:
return
if len(sbj) > 1: # TODO: more accurate subject selection
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, would have to look further into this

)

def agreement_concord(self, match: SimpleTree) -> None:
np = match.first_match("NP")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

def agreement_concord(self, match: SimpleTree) -> None:
np = match.first_match("NP")
# if vp is None: return
assert np is not None
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!


self.add_pattern(
(
"þessi", # Trigger lemma for this pattern
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, no pattern in the script triggers this function. Should I delete it or keep it in case a pattern will be added?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants