Skip to content

Instantly share code, notes, and snippets.

@mattdahl
Created January 19, 2023 02:27
Show Gist options
  • Save mattdahl/a563a48ac512275d893907dd19acd4ae to your computer and use it in GitHub Desktop.
Save mattdahl/a563a48ac512275d893907dd19acd4ae to your computer and use it in GitHub Desktop.
from courts_db import courts
# Get all citation strings
court_strings = [c['citation_string'] for c in courts if c['citation_string'] != '']
# How many existing collisions are there?
len(court_strings) - len(set(court_strings)) # Returns 148
# Remove the existing collisions
court_strings = list(set(court_strings))
# Strip out whitespace from each string
court_strings_stripped = [c.replace(' ','') for c in court_strings]
# Test for new collisions
len(set(court_strings_stripped)) == len(court_strings) # Returns True, i.e., no new collisions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment