{"id":2433,"library":"cleanco","title":"Cleanco","description":"Cleanco is a Python library (current version 2.3) designed to process company names. It cleans names by stripping away terms indicating organization type (like 'Ltd.' or 'Corp.'), deduces the business entity type (e.g., 'limited liability company'), and suggests possible countries of establishment. Releases are somewhat irregular, with recent updates in late 2023 and early 2024.","status":"active","version":"2.3","language":"python","source_language":"en","source_url":"https://github.com/psolin/cleanco","tags":["company names","natural language processing","nlp","data cleaning","business entities"],"install":[{"cmd":"pip install cleanco","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"The old class-based API (cleanco.cleanco().clean_name()) was removed in version 2.2. Use the functional API (cleanco.basename()) instead.","wrong":"from cleanco import cleanco; x = cleanco(name); x.clean_name()","symbol":"basename","correct":"from cleanco import basename"},{"note":"Use this function for advanced customization with your own terms.","symbol":"custom_basename","correct":"from cleanco import custom_basename"},{"note":"`prepare_terms()` was renamed to `prepare_default_terms()` in version 2.2.","wrong":"from cleanco import prepare_terms","symbol":"prepare_default_terms","correct":"from cleanco import prepare_default_terms"}],"quickstart":{"code":"from cleanco import basename, typesources, matches, countrysources\n\nbusiness_name = \"Some Big Pharma, LLC\"\ncleaned_name = basename(business_name)\nprint(f\"Cleaned name: {cleaned_name}\")\n\nclassification_sources = typesources()\nbusiness_types = matches(business_name, classification_sources)\nprint(f\"Business types: {business_types}\")\n\ncountry_classification_sources = countrysources()\npossible_countries = matches(business_name, country_classification_sources)\nprint(f\"Possible countries: {possible_countries}\")","lang":"python","description":"This example demonstrates how to clean a company name, deduce its business type, and suggest possible countries of origin using the primary functions of the cleanco library."},"warnings":[{"fix":"Migrate to the new functional API, primarily `from cleanco import basename` and `basename(name)`.","message":"The old class-based API, such as `cleanco.cleanco(name).clean_name()`, was entirely removed in version 2.2.","severity":"breaking","affected_versions":">=2.2"},{"fix":"Update imports and function calls from `prepare_terms` to `prepare_default_terms`.","message":"The function `prepare_terms()` was renamed to `prepare_default_terms()` in version 2.2.","severity":"breaking","affected_versions":">=2.2"},{"fix":"Ensure your project runs on Python 3.6 or newer (2.3 supports 3.8-3.12).","message":"Cleanco moved to be Python 3 only from version 2.0.1.","severity":"breaking","affected_versions":">=2.0.1"},{"fix":"Review calls to `basename()` and remove redundant `terms` arguments. For custom terms, switch to `custom_basename()`.","message":"From version 2.2 onwards, terms no longer need to be explicitly passed to `basename()`, simplifying its usage. If you need custom terms, use `custom_basename()` instead.","severity":"gotcha","affected_versions":">=2.2"},{"fix":"Consider applying `basename()` in a loop or twice on names where multiple suffixes are common (e.g., 'Company, Inc. Ltd.').","message":"For company names with multiple suffixes, you might need to run `basename()` more than once to ensure all suffixes are stripped, as the internal term data might cover these iteratively.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"search_vec":"'2.3':9 '2023':53 '2024':56 'away':20 'busi':31,65 'clean':16,64 'cleanco':1,2 'compani':13,37,57 'corp':28 'countri':41 'current':7 'data':63 'deduc':29 'design':10 'e.g':34 'earli':55 'entiti':32,66 'establish':43 'indic':22 'irregular':47 'languag':60 'late':52 'liabil':36 'librari':6 'like':25 'limit':35 'ltd':26 'name':14,17,58 'natur':59 'nlp':62 'organ':23 'possibl':40 'process':12,61 'python':5 'recent':49 'releas':44 'somewhat':46 'strip':19 'suggest':39 'term':21 'type':24,33 'updat':50 'version':8","created_at":"2026-04-11T01:27:56.519922+00:00","updated_at":"2026-04-16T02:19:49.924746+00:00","problems":[{"fix":"Install the library using pip: `pip install cleanco`","cause":"The 'cleanco' library has not been installed in your Python environment or the environment where your script is being run.","error":"ModuleNotFoundError: No module named 'cleanco'"},{"fix":"For complex cases, consider running `basename()` multiple times or using `custom_basename()` with a tailored list of terms. You can also inspect the `cleanco` GitHub issues for similar edge cases and potential workarounds or updates. Example: `from cleanco import basename; cleaned_name = basename(basename('Your Company Name, Inc. Ltd.'))`","cause":"The `basename()` function might not correctly strip suffixes or might return an empty string for company names with unusual punctuation, multiple suffixes, or specific formatting that the default terms list doesn't fully cover.","error":"cleanco basename not working / cleanco returns empty string"},{"fix":"Import `typesources` (or `countrysources`) directly from the `cleanco` module: `from cleanco import typesources, matches` and then call `classification_sources = typesources()`","cause":"You are attempting to access `typesources` (or `countrysources`) as an attribute of the `cleanco` module directly, but these are functions that need to be explicitly imported from the `cleanco` package.","error":"AttributeError: module 'cleanco' has no attribute 'typesources'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":"2.3","cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/psolin/cleanco","docs":null,"changelog":null,"pypi":"https://pypi.org/project/cleanco/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["data","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"passing","verified_at":"2026-06-28","last_verified":"2026-08-28","next_check":"2026-07-28","install_tag":null}}