Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1919,7 +1919,7 @@ class DocumentCheckResultsFormatter:
|
|
1919 |
|
1920 |
return output
|
1921 |
|
1922 |
-
def _format_standard_issue(self, issue: Dict[str, Any]) -> str:
|
1923 |
"""Format a standard issue consistently."""
|
1924 |
if isinstance(issue, dict):
|
1925 |
# Handle grouped issues per sentence
|
@@ -1942,8 +1942,8 @@ class DocumentCheckResultsFormatter:
|
|
1942 |
|
1943 |
# Handle issues with occurrences list
|
1944 |
if 'occurrences' in issue:
|
1945 |
-
# Format the first
|
1946 |
-
examples = issue['occurrences'][:
|
1947 |
formatted_examples = []
|
1948 |
for example in examples:
|
1949 |
if 'sentence' in example:
|
@@ -1981,7 +1981,7 @@ class DocumentCheckResultsFormatter:
|
|
1981 |
|
1982 |
# Handle issues with description and matches
|
1983 |
elif all(k in issue for k in ['issue_type', 'description', 'matches']):
|
1984 |
-
matches_str = '; '.join(str(m) for m in issue['matches'][:
|
1985 |
return textwrap.fill(
|
1986 |
f" • {issue['description']} - Found: {matches_str}",
|
1987 |
width=76,
|
@@ -2013,16 +2013,17 @@ class DocumentCheckResultsFormatter:
|
|
2013 |
if isinstance(v, list):
|
2014 |
if all(isinstance(item, dict) for item in v):
|
2015 |
# Handle list of dictionaries
|
2016 |
-
v_str = '; '.join(str(item.get('sentence', str(item))) for item in v[:
|
2017 |
else:
|
2018 |
# Handle list of strings
|
2019 |
-
v_str = ', '.join(str(item) for item in v[:
|
2020 |
message_parts.append(f"{k}: {v_str}")
|
2021 |
else:
|
2022 |
message_parts.append(f"{k}: {v}")
|
2023 |
return f" • {'; '.join(message_parts)}"
|
2024 |
|
2025 |
return f" • {str(issue)}"
|
|
|
2026 |
|
2027 |
def format_results(self, results: Dict[str, Any], doc_type: str) -> str:
|
2028 |
"""
|
|
|
1919 |
|
1920 |
return output
|
1921 |
|
1922 |
+
def _format_standard_issue(self, issue: Dict[str, Any]) -> str:
|
1923 |
"""Format a standard issue consistently."""
|
1924 |
if isinstance(issue, dict):
|
1925 |
# Handle grouped issues per sentence
|
|
|
1942 |
|
1943 |
# Handle issues with occurrences list
|
1944 |
if 'occurrences' in issue:
|
1945 |
+
# Format the first 7 occurrences
|
1946 |
+
examples = issue['occurrences'][:7]
|
1947 |
formatted_examples = []
|
1948 |
for example in examples:
|
1949 |
if 'sentence' in example:
|
|
|
1981 |
|
1982 |
# Handle issues with description and matches
|
1983 |
elif all(k in issue for k in ['issue_type', 'description', 'matches']):
|
1984 |
+
matches_str = '; '.join(str(m) for m in issue['matches'][:7])
|
1985 |
return textwrap.fill(
|
1986 |
f" • {issue['description']} - Found: {matches_str}",
|
1987 |
width=76,
|
|
|
2013 |
if isinstance(v, list):
|
2014 |
if all(isinstance(item, dict) for item in v):
|
2015 |
# Handle list of dictionaries
|
2016 |
+
v_str = '; '.join(str(item.get('sentence', str(item))) for item in v[:7])
|
2017 |
else:
|
2018 |
# Handle list of strings
|
2019 |
+
v_str = ', '.join(str(item) for item in v[:7])
|
2020 |
message_parts.append(f"{k}: {v_str}")
|
2021 |
else:
|
2022 |
message_parts.append(f"{k}: {v}")
|
2023 |
return f" • {'; '.join(message_parts)}"
|
2024 |
|
2025 |
return f" • {str(issue)}"
|
2026 |
+
|
2027 |
|
2028 |
def format_results(self, results: Dict[str, Any], doc_type: str) -> str:
|
2029 |
"""
|