Skip to content

Commit

Permalink
languages: fix predictions for editorial/introduction
Browse files Browse the repository at this point in the history
  • Loading branch information
geritwagner committed Mar 28, 2023
1 parent 062a415 commit 93fc7e8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions colrev/env/language_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def __init__(self) -> None:
def compute_language_confidence_values(self, *, text: str) -> list:
"""Computes the most likely languages of a string and their language codes"""

if text.lower() in ["editorial", "introduction"]:
return [("eng", 1.0)]

predictions = (
self.__lingua_language_detector.compute_language_confidence_values(
text=text
Expand Down
8 changes: 8 additions & 0 deletions tests/1_env/language_service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def language_service() -> colrev.env.language_service.LanguageService: # type:
"An Integrated Framework for Understanding Digital Work in Organizations",
("eng", 0.9),
),
(
"Editorial",
("eng", 0.9),
),
(
"Introduction",
("eng", 0.9),
),
],
)
def test_compute_language_confidence_values(
Expand Down

0 comments on commit 93fc7e8

Please sign in to comment.