Skip to content

Commit

Permalink
feat: Backup to first section head if title not found
Browse files Browse the repository at this point in the history
  • Loading branch information
clemlesne committed Jun 7, 2024
1 parent ff5ff4f commit 3fdb73a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion function_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,15 @@ async def raw_to_extracted(input: BlobClientTrigger) -> None:
paragraph
for paragraph in doc_result.paragraphs or []
if paragraph.role == ParagraphRole.TITLE
), # First, title
next(
(
paragraph
for paragraph in doc_result.paragraphs or []
if paragraph.role == ParagraphRole.SECTION_HEADING
), # Second, section heading
None, # Third, nothing
),
None,
)
raw_text_model = RawTextModel(
content=doc_result.content,
Expand Down

0 comments on commit 3fdb73a

Please sign in to comment.