Skip to content

Commit

Permalink
fix: remove defaults from sectioner args
Browse files Browse the repository at this point in the history
`_split_elements_by_title_and_table()` is an implementation function
(private). It is called only by `chunk_by_title()` (outside tests) and
with all arguments specified, so has no need for defaults since they are
never used and complicate reasoning about its behavior.

Remove defaults from all parameters to
`_split_elements_by_title_and_table()`.
  • Loading branch information
scanny committed Oct 24, 2023
1 parent 4a296af commit a7ab984
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion test_unstructured/chunking/test_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,13 @@ def test_split_elements_by_title_and_table():
Text("It is storming outside."),
CheckBox(),
]
sections = _split_elements_by_title_and_table(elements, combine_text_under_n_chars=0)
sections = _split_elements_by_title_and_table(
elements,
multipage_sections=True,
combine_text_under_n_chars=0,
new_after_n_chars=500,
max_characters=500,
)

assert sections == [
[
Expand Down
8 changes: 4 additions & 4 deletions unstructured/chunking/title.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ def chunk_by_title(

def _split_elements_by_title_and_table(
elements: List[Element],
multipage_sections: bool = True,
combine_text_under_n_chars: int = 500,
new_after_n_chars: int = 500,
max_characters: int = 500,
multipage_sections: bool,
combine_text_under_n_chars: int,
new_after_n_chars: int,
max_characters: int,
) -> List[List[Element]]:
sections: List[List[Element]] = []
section: List[Element] = []
Expand Down

0 comments on commit a7ab984

Please sign in to comment.