Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions machine/punctuation_analysis/usfm_structure_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ def chapter(
pub_number: Optional[str],
) -> None:
self._next_text_segment_builder.add_preceding_marker(UsfmMarkerType.CHAPTER)
chapter_number: int = int(number) if number.isdigit() else 0
self._next_text_segment_builder.set_chapter(chapter_number)
self._next_text_segment_builder.set_chapter(state.verse_ref.chapter_num)

def start_para(
self,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ reportMissingModuleSource = false

[tool.poetry]
name = "sil-machine"
version = "1.8.3"
version = "1.8.4"
description = "A natural language processing library that is focused on providing tools for resource-poor languages."
license = "MIT"
authors = ["SIL International"]
Expand Down
3 changes: 3 additions & 0 deletions tests/punctuation_analysis/test_usfm_structure_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,15 @@ def test_get_chapters_filter_by_book():
def test_get_chapters_filter_by_chapter():
usfm_structure_extractor = UsfmStructureExtractor()
usfm_structure_extractor.start_book(verse_text_parser_state, "id", "MAT")
verse_text_parser_state.verse_ref.chapter_num = 1
usfm_structure_extractor.chapter(verse_text_parser_state, "1", "c", None, None)
usfm_structure_extractor.verse(verse_text_parser_state, "1", "v", None, None)
usfm_structure_extractor.text(verse_text_parser_state, "test")
verse_text_parser_state.verse_ref.chapter_num = 2
usfm_structure_extractor.chapter(verse_text_parser_state, "2", "c", None, None)
usfm_structure_extractor.verse(verse_text_parser_state, "1", "v", None, None)
usfm_structure_extractor.text(verse_text_parser_state, "test2")
verse_text_parser_state.verse_ref.chapter_num = 3
usfm_structure_extractor.chapter(verse_text_parser_state, "3", "c", None, None)
usfm_structure_extractor.verse(verse_text_parser_state, "1", "v", None, None)
usfm_structure_extractor.text(verse_text_parser_state, "test3")
Expand Down