Skip to content

Commit

Permalink
added more logging per skye's request
Browse files Browse the repository at this point in the history
  • Loading branch information
ashkankzme committed Aug 6, 2024
1 parent 967189d commit d00bad4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/model/classycat_classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ def classify_and_store_results(self, schema_id, items):
# and items with no labels can be retried later by the user, indicated by an empty list for labels
permitted_labels = [topic['topic'] for topic in schema['topics']] + ['Other', 'Unsure']
for result in final_results:

# log the items that had at least one out-of-schema label
if not all([label in permitted_labels for label in result['labels']]):
logger.error(f"Item {result['id']} had out-of-schema labels: {result['labels']}, permitted labels: {permitted_labels}")

result['labels'] = [label for label in result['labels'] if label in permitted_labels]

if not all([len(result['labels']) == 0 for result in final_results]):
Expand Down

0 comments on commit d00bad4

Please sign in to comment.