DY0-001 · Question #20
A data scientist is standardizing a large data set that contains website addresses. A specific string inside some of the web addresses needs to be extracted. Which of the following is the best…
The correct answer is A. Regular expressions. Regular expressions (regex) are purpose-built for pattern matching and extraction within strings, making them ideal for pulling specific substrings from URLs - they're fast, precise, and require no external models or manual effort. Named-entity recognition (B) is an NLP…
Question
A data scientist is standardizing a large data set that contains website addresses. A specific string inside some of the web addresses needs to be extracted. Which of the following is the best method for extracting the desired string from the text data?
Options
- ARegular expressions
- BNamed-entity recognition
- CLarge language model
- DFind and replace
How the community answered
(39 responses)- A90% (35)
- B5% (2)
- C3% (1)
- D3% (1)
Explanation
Regular expressions (regex) are purpose-built for pattern matching and extraction within strings, making them ideal for pulling specific substrings from URLs - they're fast, precise, and require no external models or manual effort. Named-entity recognition (B) is an NLP technique designed to identify real-world entities like names and places in natural language text, not for pattern-based string extraction in structured data like URLs. A large language model (C) would be a massive overkill - computationally expensive, non-deterministic, and unnecessary when a simple pattern rule suffices. Find and replace (D) can locate and swap text but doesn't extract a substring into a new field, and it lacks the flexibility to handle variable patterns across thousands of records.
Memory tip: Think of regex as a Swiss Army knife for strings - whenever an exam mentions extracting, matching, or validating patterns in text data (emails, URLs, phone numbers), regex is almost always the answer.
Topics
Community Discussion
No community discussion yet for this question.