Skip to content

Commit

Permalink
Merge branch 'main' into include_more_characters
Browse files Browse the repository at this point in the history
  • Loading branch information
Mkranj authored Jan 4, 2023
2 parents e535510 + 6703946 commit ee10d34
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 2 additions & 0 deletions PapersCited.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ class PhrasesToChange:
"suradnicima": "sur.",
"suradnici": "sur.",
"suradnika": "sur.",
# Change possesive form to a proper noun
"'s" : ""
}
# Before adding something to excluded phrases, Google [word] surname.
# If anything shows up, don't include that word.
Expand Down
21 changes: 20 additions & 1 deletion tests/test_detecting_authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,23 @@ def test_new_foreign_characters():
["Bø (1999", "Yø (2000", "Så (2001"]
text_non_alphanumeric = "Bø's (1999) research cited Yø-yoma (2000)"
assert PapersCited.get_matches_solo_author(text_non_alphanumeric).citations ==\
["Bø's (1999", "Yø-yoma (2000"]
["Bø's (1999", "Yø-yoma (2000"]

def test_possesive_recognised_and_adjusted():
possesive_text = "Listen to Cohen's (1999) talk."
matches = PapersCited.get_matches_solo_author(possesive_text)
matches.cleanup()
assert matches.citations == ["Cohen 1999"]
# When both possesive and regular form are cited, this should result in a single,
# proper form citation.
possesive_and_regular = "Listen to Cohen's (1999) talk. Or read Cohen (1999)"
matches = PapersCited.get_matches_solo_author(possesive_and_regular)
matches.cleanup()
assert matches.citations == ["Cohen 1999"]

def test_surnames_apostrophe_s_recognised():
text = "O'Sullivan (2000) wrote a paper. Compare it to O'Samuel's (1999) work."
matches = PapersCited.get_matches_solo_author(text)
matches.cleanup()
assert matches.citations == ["O'Samuel 1999", "O'Sullivan 2000"]

0 comments on commit ee10d34

Please sign in to comment.