duck.utils.extractionยถ
Extraction Utilities Module
This module provides various utilities to extract specific types of information from a given text. These utilities can be used for extracting URLs, email addresses, phone numbers, hashtags, mentions, and other patterns that are commonly needed in text processing tasks such as web scraping, form validation, or text analysis.
Functions include:
extract_urls: Extracts all URLs from a given text.extract_emails: Extracts all email addresses from a given text.extract_phone_numbers: Extracts all phone numbers from a given text.extract_hashtags: Extracts all hashtags from a given text.extract_mentions: Extracts all mentions (usernames) from a given text.extract_dates: Extracts all date-like patterns from a given text.
extract_currency: Extracts all currency values from a given text.extract_ips: Extracts all IP addresses from a given text.extract_social_handles: Extracts social media handles (like Twitter, Instagram) from a given text.extract_hex_colors: Extracts all hex color codes from a given text.extract_skus: Extracts all product SKUs (Stock Keeping Units) from a given text.
Module Contentsยถ
Functionsยถ
Extracts all currency values from the provided text. |
|
Extracts all date-like patterns from the provided text. |
|
Extracts all email addresses from the provided text. |
|
Extracts all hashtags from the provided text. |
|
Extracts all hex color codes from the provided text. |
|
Extracts all IP addresses (IPv4) from the provided text. |
|
Extracts all mentions (usernames) from the provided text. |
|
Extracts all phone numbers from the provided text. |
|
Extracts all product SKUs (Stock Keeping Units) from the provided text. |
|
Extracts social media handles from the provided text (e.g., @username). |
|
Extracts all URLs from the provided text. |
APIยถ
- duck.utils.extraction.extract_currency(text: str) List[str][source]ยถ
Extracts all currency values from the provided text.
- duck.utils.extraction.extract_dates(text: str) List[str][source]ยถ
Extracts all date-like patterns from the provided text.
- duck.utils.extraction.extract_emails(text: str) List[str][source]ยถ
Extracts all email addresses from the provided text.
- duck.utils.extraction.extract_hashtags(text: str) List[str][source]ยถ
Extracts all hashtags from the provided text.
- duck.utils.extraction.extract_hex_colors(text: str) List[str][source]ยถ
Extracts all hex color codes from the provided text.
- Parameters:
text โ The input string to extract hex color codes from.
- Returns:
A list of extracted hex color codes.
- Return type:
list
- duck.utils.extraction.extract_ips(text: str) List[str][source]ยถ
Extracts all IP addresses (IPv4) from the provided text.
- Parameters:
text โ The input string to extract IP addresses from.
- Returns:
A list of extracted IP addresses.
- Return type:
list
- duck.utils.extraction.extract_mentions(text: str) List[str][source]ยถ
Extracts all mentions (usernames) from the provided text.
- duck.utils.extraction.extract_phone_numbers(text: str) List[str][source]ยถ
Extracts all phone numbers from the provided text.
- duck.utils.extraction.extract_skus(text: str) List[str][source]ยถ
Extracts all product SKUs (Stock Keeping Units) from the provided text.
- Parameters:
text โ The input string to extract SKUs from.
- Returns:
A list of extracted SKUs.
- Return type:
list