Skip to content

Commit 29be81e

Browse files
author
Ben King
committed
Include analysis details in QuoteConventionAnalysis
1 parent ee01a7f commit 29be81e

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

machine/corpora/punctuation_analysis/quote_convention_detector.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
class QuoteConventionAnalysis:
2020
best_quote_convention: QuoteConvention
2121
best_quote_convention_score: float
22+
analysis_summary: str
2223

2324

2425
class QuoteConventionDetector(UsfmStructureExtractor):
@@ -50,16 +51,15 @@ def _count_quotation_marks_in_chapter(
5051

5152
self._quotation_mark_tabulator.tabulate(resolved_quotation_marks)
5253

53-
def detect_quote_convention(self, print_summary: bool) -> Optional[QuoteConventionAnalysis]:
54+
def detect_quote_convention(self) -> Optional[QuoteConventionAnalysis]:
5455
self._count_quotation_marks_in_chapters(self.get_chapters())
5556

5657
(best_quote_convention, score) = STANDARD_QUOTE_CONVENTIONS.find_most_similar_convention(
5758
self._quotation_mark_tabulator
5859
)
5960

60-
if print_summary:
61-
print(self._quotation_mark_tabulator.get_summary_message())
62-
6361
if score > 0 and best_quote_convention is not None:
64-
return QuoteConventionAnalysis(best_quote_convention, score)
62+
return QuoteConventionAnalysis(
63+
best_quote_convention, score, self._quotation_mark_tabulator.get_summary_message()
64+
)
6565
return None

tests/corpora/punctuation_analysis/test_quote_convention_detector.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,4 +302,4 @@ def test_mismatched_quotation_marks() -> None:
302302
def detect_quote_convention(usfm: str) -> Union[QuoteConventionAnalysis, None]:
303303
quote_convention_detector = QuoteConventionDetector()
304304
parse_usfm(usfm, quote_convention_detector)
305-
return quote_convention_detector.detect_quote_convention(print_summary=False)
305+
return quote_convention_detector.detect_quote_convention()

0 commit comments

Comments
 (0)