mirror of
https://github.com/marcogll/telegram_expenses_controller.git
synced 2026-01-13 13:25:15 +00:00
feat: Implement core application structure, AI extraction, persistence, and Telegram bot modules with updated configuration and dependencies.
This commit is contained in:
0
app/preprocessing/__init__.py
Normal file
0
app/preprocessing/__init__.py
Normal file
11
app/preprocessing/language_detect.py
Normal file
11
app/preprocessing/language_detect.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""
|
||||
Language detection functions.
|
||||
"""
|
||||
|
||||
def detect_language(text: str) -> str:
|
||||
"""
|
||||
Detects the language of a given text.
|
||||
Stub function.
|
||||
"""
|
||||
# In a real app, use a library like 'langdetect' or 'google-cloud-translate'
|
||||
return "en" # Assume English for now
|
||||
11
app/preprocessing/normalize_text.py
Normal file
11
app/preprocessing/normalize_text.py
Normal file
@@ -0,0 +1,11 @@
|
||||
"""
|
||||
Text normalization functions.
|
||||
"""
|
||||
|
||||
def normalize_text(text: str) -> str:
|
||||
"""
|
||||
Normalizes a string by converting it to lowercase and stripping whitespace.
|
||||
"""
|
||||
if not text:
|
||||
return ""
|
||||
return text.lower().strip()
|
||||
13
app/preprocessing/validators.py
Normal file
13
app/preprocessing/validators.py
Normal file
@@ -0,0 +1,13 @@
|
||||
"""
|
||||
Data validation functions.
|
||||
"""
|
||||
|
||||
def is_valid_expense(data: dict) -> bool:
|
||||
"""
|
||||
Validates if the extracted data for an expense is plausible.
|
||||
Stub function.
|
||||
"""
|
||||
# Example validation: amount must be positive
|
||||
if "amount" in data and data["amount"] <= 0:
|
||||
return False
|
||||
return True
|
||||
Reference in New Issue
Block a user