{"id":21158725,"url":"https://github.com/aflah02/cleansetext","last_synced_at":"2025-10-06T11:35:09.720Z","repository":{"id":65144129,"uuid":"582491655","full_name":"aflah02/cleansetext","owner":"aflah02","description":"This is a simple library to help you clean your textual data","archived":false,"fork":false,"pushed_at":"2023-01-02T14:18:47.000Z","size":132,"stargazers_count":6,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-19T02:27:11.562Z","etag":null,"topics":["cleaning-data","nlp","preprocessing","pypi","text"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/cleansetext/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aflah02.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-12-27T02:19:18.000Z","updated_at":"2024-03-12T00:28:14.000Z","dependencies_parsed_at":"2023-02-01T03:00:45.393Z","dependency_job_id":null,"html_url":"https://github.com/aflah02/cleansetext","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/aflah02/cleansetext","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aflah02%2Fcleansetext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aflah02%2Fcleansetext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aflah02%2Fcleansetext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aflah02%2Fcleansetext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aflah02","download_url":"https://codeload.github.com/aflah02/cleansetext/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aflah02%2Fcleansetext/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272356297,"owners_count":24920281,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-27T02:00:09.397Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cleaning-data","nlp","preprocessing","pypi","text"],"created_at":"2024-11-20T12:33:02.907Z","updated_at":"2025-10-06T11:35:04.695Z","avatar_url":"https://github.com/aflah02.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CleanseText\n\n![](https://github.com/aflah02/cleansetext/actions/workflows/python-publish.yml/badge.svg)\n![](https://github.com/aflah02/cleansetext/actions/workflows/python-package.yml/badge.svg)\n\nThis is a simple library to help you clean your textual data.\n\n## Why do I need this?\n\nHonestly there are several packages out there which do similar things, but they've never really worked well for my use cases or don't have all the features I need. So I decided to make my own.\n\nThe API design is made to be readable, and I don't hesitate to create functions even for trivial tasks as they make reaching the goal easier.\n\n## How to Install?\n\n`pip install cleansetext`\n\n## Sample usage\n\n```\nfrom cleansetext.pipeline import Pipeline\nfrom cleansetext.steps import *\nfrom nltk.tokenize import TweetTokenizer\ntk = TweetTokenizer()\n\n# Create a pipeline with a list of preprocessing steps\npipeline = Pipeline([\n    RemoveEmojis(),\n    RemoveAllPunctuations(),\n    RemoveTokensWithOnlyPunctuations(),\n    ReplaceURLsandHTMLTags(),\n    ReplaceUsernames(),\n    RemoveWhiteSpaceOrChunksOfWhiteSpace()\n], track_diffs=True)\n\n# Process text\ntext = \"@Mary I hate you    and everything about you ...... 🎉🎉 google.com\"\ntext = tk.tokenize(text)\n\nprint(text)\n# Output: ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '...', '🎉', '🎉', 'google.com']\n\nprint(pipeline.process(text))\n\n# Output:\n# ['\u003cUSER\u003e', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '\u003cURL\u003e']\n\npipeline.explain(show_diffs=True)\n\n# Output:\n# Step 1: Remove emojis from text | Language: en\n# Diff: ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '...', '🎉', '🎉', 'google.com'] -\u003e ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '...', 'google.com']\n# Step 2: Remove all punctuations from a list of words | Punctuations: !\"#$%\u0026'()*+,-./:;\u003c=\u003e?@[\\]^_`{|}~\n# Diff: ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '...', 'google.com'] -\u003e ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '...', 'google.com']\n# Step 3: Remove tokens with only punctuations from a list of words | Punctuations: !\"#$%\u0026'()*+,-./:;\u003c=\u003e?@[\\]^_`{|}~\n# Diff: ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '...', 'google.com'] -\u003e ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', 'google.com']\n# Step 4: Remove URLs and HTML tags from a sentence | Replace with: \u003cURL\u003e\n# Diff: ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', 'google.com'] -\u003e ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '\u003cURL\u003e']\n# Step 5: Remove usernames from a sentence | Replace with: \u003cUSER\u003e\n# Diff: ['@Mary', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '\u003cURL\u003e'] -\u003e ['\u003cUSER\u003e', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '\u003cURL\u003e']\n# Step 6: Remove whitespace from a sentence or chunks of whitespace\n# Diff: ['\u003cUSER\u003e', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '\u003cURL\u003e'] -\u003e ['\u003cUSER\u003e', 'I', 'hate', 'you', 'and', 'everything', 'about', 'you', '\u003cURL\u003e']\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faflah02%2Fcleansetext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faflah02%2Fcleansetext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faflah02%2Fcleansetext/lists"}