extract_title

RadReportExtractor.extract_title(
    text: str,
    include_key: bool = True,
    word_boundary: bool = False,
    flags: Union[re.RegexFlag, int] = re.IGNORECASE,
    match_strategy: Literal['greedy', 'sequential'] = 'greedy',
    verbose: bool = True,
)

Extract the title section from the radiology report text.

Parameters

Name Type Description Default
text str The input radiology report text. required
include_key bool Whether to include the section key in output, by default True True
word_boundary bool Whether to wrap word boundary  around the section keys, by default False False
flags Union[re.RegexFlag, int] Regex flags to use in pattern matching. For ‘re’ backend: These are directly passed to re.compile() For ‘re2’ backend: These are converted to re2.Options properties By default re.IGNORECASE re.IGNORECASE
match_strategy (greedy, sequential) Strategy for matching end keys: - “greedy”: Use first matching end key (faster) - “sequential”: Try end keys in order (more precise) Default is “greedy” "greedy"
verbose bool If True, prints messages if multiple start matches are found. Default is True. True

Returns

Name Type Description
str The extracted title section text. Returns empty string if section not found.