Fix nonrewards detection for German files (case-insensitive, add functional factor)
Browse files
app.py
CHANGED
|
@@ -18,7 +18,8 @@ st.set_page_config(
|
|
| 18 |
# HELPER FUNCTIONS
|
| 19 |
# =============================================================================
|
| 20 |
|
| 21 |
-
|
|
|
|
| 22 |
|
| 23 |
def detect_data_start_row(df):
|
| 24 |
"""Find DATA_START_ROW by detecting the 2nd text block in column B."""
|
|
@@ -80,7 +81,7 @@ def detect_nonrewards_patterns(df, data_start_idx):
|
|
| 80 |
parts = code.split('_')
|
| 81 |
if len(parts) >= 3:
|
| 82 |
factor = parts[2]
|
| 83 |
-
if factor in NONREWARDS_FACTORS:
|
| 84 |
key = f'_{factor}_'
|
| 85 |
patterns_found[key] = patterns_found.get(key, 0) + 1
|
| 86 |
|
|
@@ -129,7 +130,7 @@ def generate_network_html(df, data_start_row, corr_col_start, threshold, max_l1_
|
|
| 129 |
parts = code_str.split('_')
|
| 130 |
if len(parts) >= 3:
|
| 131 |
factor = parts[2]
|
| 132 |
-
if factor in NONREWARDS_FACTORS:
|
| 133 |
nonrewards_attrs.add(str(attr_name))
|
| 134 |
else:
|
| 135 |
break
|
|
|
|
| 18 |
# HELPER FUNCTIONS
|
| 19 |
# =============================================================================
|
| 20 |
|
| 21 |
+
# Nonrewards factors (both EN and DE) - compared case-insensitively
|
| 22 |
+
NONREWARDS_FACTORS = ['features', 'functionalgoals', 'occasions', 'functional']
|
| 23 |
|
| 24 |
def detect_data_start_row(df):
|
| 25 |
"""Find DATA_START_ROW by detecting the 2nd text block in column B."""
|
|
|
|
| 81 |
parts = code.split('_')
|
| 82 |
if len(parts) >= 3:
|
| 83 |
factor = parts[2]
|
| 84 |
+
if factor.lower() in NONREWARDS_FACTORS:
|
| 85 |
key = f'_{factor}_'
|
| 86 |
patterns_found[key] = patterns_found.get(key, 0) + 1
|
| 87 |
|
|
|
|
| 130 |
parts = code_str.split('_')
|
| 131 |
if len(parts) >= 3:
|
| 132 |
factor = parts[2]
|
| 133 |
+
if factor.lower() in NONREWARDS_FACTORS:
|
| 134 |
nonrewards_attrs.add(str(attr_name))
|
| 135 |
else:
|
| 136 |
break
|