Update app.py
Browse files
app.py
CHANGED
@@ -35,12 +35,30 @@ def format_neo4j_datetime(dt) -> str:
|
|
35 |
return 'Unknown date'
|
36 |
|
37 |
def is_displayable_keyword(keyword: str) -> bool:
|
38 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
if not keyword:
|
40 |
return False
|
41 |
-
|
42 |
-
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
def format_interest_list_for_display(interests: set, max_items: int = 10) -> str:
|
46 |
"""Format a list of interests for display, hiding numeric-only keywords."""
|
|
|
35 |
return 'Unknown date'
|
36 |
|
37 |
def is_displayable_keyword(keyword: str) -> bool:
|
38 |
+
"""
|
39 |
+
Check if a keyword should be displayed (not just numbers and separators).
|
40 |
+
Filters out:
|
41 |
+
- Pure numbers (1234)
|
42 |
+
- Numbers with dots (15.10)
|
43 |
+
- Numbers with dashes (2023-01)
|
44 |
+
- Numbers with spaces (15 10)
|
45 |
+
- Numbers with slashes (15/10)
|
46 |
+
- Any combination of above
|
47 |
+
"""
|
48 |
if not keyword:
|
49 |
return False
|
50 |
+
|
51 |
+
# Remove all common number separators and spaces
|
52 |
+
cleaned = keyword.replace('.', '') \
|
53 |
+
.replace('-', '') \
|
54 |
+
.replace('/', '') \
|
55 |
+
.replace('\\', '') \
|
56 |
+
.replace(' ', '') \
|
57 |
+
.replace(':', '') \
|
58 |
+
.replace(',', '')
|
59 |
+
|
60 |
+
# Check if what remains is just digits
|
61 |
+
return not cleaned.isdigit()
|
62 |
|
63 |
def format_interest_list_for_display(interests: set, max_items: int = 10) -> str:
|
64 |
"""Format a list of interests for display, hiding numeric-only keywords."""
|