INNER CODE UNIT · Python

normalize_content

grobidOrg/grobid · grobid-trainer/scripts/check_note_consistency.py:55

def normalize_content(content):
    """
    Normalize content for better matching by removing extra whitespace and standardizing line breaks.
    """
    # Replace multiple whitespace with single space
    content = re.sub(r'\s+', ' ', content)
    # Remove leading/trailing whitespace
    content = content.strip()
    return content


def check_file_consistency(xml_file_path, verbose=False):
    """
    Check a single TEI file for internal consistency issues.
    Returns list of inconsistencies found.
    """
    headnotes, footnotes = extract_note_content(xml_file_path)
    inconsistencies = []

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…