mirror of
https://github.com/marcogll/telegram_expenses_controller.git
synced 2026-01-13 13:25:15 +00:00
17 lines
440 B
Python
17 lines
440 B
Python
"""
|
|
Functions for calculating confidence scores.
|
|
"""
|
|
|
|
def calculate_confidence(extracted_data: dict) -> float:
|
|
"""
|
|
Calculates a confidence score based on the quality of the extracted data.
|
|
Stub function.
|
|
"""
|
|
score = 1.0
|
|
# Lower score if key fields are missing
|
|
if not extracted_data.get("amount"):
|
|
score -= 0.5
|
|
if not extracted_data.get("description"):
|
|
score -= 0.3
|
|
return max(0.0, score)
|