MLOps Engineer | Share 700+ tips on Python and data science
Aug 5 • 4 tweets • 1 min read
🧵 1/4: Turn failed exact matches into successful fuzzy matches with difflib!
Have you ever spent hours cleaning text data with regex, only to find that "iPhone 14 Pro Max" still doesn't match "iPhone 14 Prro Max"?
There's a better way 👇
🧵 2/4: Regex preprocessing achieves only exact matching after cleaning, failing completely with typos and character variations that exact matching cannot handle.
This is where difflib comes in...
Oct 3, 2024 • 4 tweets • 1 min read
Use the Open-Closed Principle to create easily extendable classes without modifying existing code. This approach reduces the risk of introducing bugs in existing, tested code and allows for easy addition of new features or functionalities.
In the example below: 1. First Approach: DataVisualizer uses conditional logic to choose charts. This requires changes to the visualize method whenever a new chart type is added.