INNER CODE UNIT · Python
calculate_table_character_percentages
lefterisloukas/edgar-crawler · extract_items.py:336
def calculate_table_character_percentages(table_text: str) -> Tuple[float, float]:
"""
Calculate character type percentages contained in the table text
Args:
table_text (str): The table text
Returns:
Tuple[float, float]: Percentage of non-blank digit characters, Percentage of space characters
"""
digits = sum(
c.isdigit() for c in table_text
) # Count the number of digit characters
spaces = sum(
c.isspace() for c in table_text
) # Count the number of space characters
if len(table_text) - spaces: