Spaces:
Build error
Build error
debug
Browse files- analyze.py +3 -1
analyze.py
CHANGED
@@ -72,12 +72,15 @@ def _simple_analyze_iterator_cache(
|
|
72 |
score_threshold: float,
|
73 |
cache: dict[str, list[RecognizerResult]],
|
74 |
) -> list[list[RecognizerResult]]:
|
|
|
|
|
75 |
not_cached_results = iter(
|
76 |
batch_analyzer.analyze_iterator(
|
77 |
(text for text in texts if text not in cache), language=language, score_threshold=score_threshold
|
78 |
)
|
79 |
)
|
80 |
results = [cache[text] if text in cache else next(not_cached_results) for text in texts]
|
|
|
81 |
# cache the last results
|
82 |
cache.clear()
|
83 |
cache.update(dict(zip(texts, results)))
|
@@ -98,7 +101,6 @@ def analyze(
|
|
98 |
for example in batch
|
99 |
for column_name, columns_description in zip(scanned_columns, columns_descriptions)
|
100 |
]
|
101 |
-
print(texts)
|
102 |
return [
|
103 |
PresidioEntity(
|
104 |
text=mask(texts[i][recognizer_result.start : recognizer_result.end]),
|
|
|
72 |
score_threshold: float,
|
73 |
cache: dict[str, list[RecognizerResult]],
|
74 |
) -> list[list[RecognizerResult]]:
|
75 |
+
print(cache)
|
76 |
+
print(texts)
|
77 |
not_cached_results = iter(
|
78 |
batch_analyzer.analyze_iterator(
|
79 |
(text for text in texts if text not in cache), language=language, score_threshold=score_threshold
|
80 |
)
|
81 |
)
|
82 |
results = [cache[text] if text in cache else next(not_cached_results) for text in texts]
|
83 |
+
print(results)
|
84 |
# cache the last results
|
85 |
cache.clear()
|
86 |
cache.update(dict(zip(texts, results)))
|
|
|
101 |
for example in batch
|
102 |
for column_name, columns_description in zip(scanned_columns, columns_descriptions)
|
103 |
]
|
|
|
104 |
return [
|
105 |
PresidioEntity(
|
106 |
text=mask(texts[i][recognizer_result.start : recognizer_result.end]),
|