Skip to main content

A blazing-fast C extension for text cleaning

Project description

FastCleaner 🧹

一个极其轻量、极速的 Python 文本清洗库。使用纯 C 语言编写。

它可以帮你瞬间洗掉文本里的标点符号、Emoji 表情和各种特殊字符,非常适合做数据预处理和 NLP(自然语言处理)清洗任务。

📦 安装

pip install fast_cleaner

🚀 如何使用

1. 基础清洗(默认)

自动过滤掉中英文标点符号和 Emoji。

import fast_cleaner

dirty_text = "Hello, World! 这是一个测试... 🤣 你好,世界!"
clean_text = fast_cleaner.clean(dirty_text)

print(clean_text)
# 输出: Hello World 这是一个测试 你好世界

2. 严格模式 (Mode = 1)

如果你在处理含有小语种特殊标点(比如西班牙语的 ¡、¿,或者阿拉伯语的 、)的文本,可以加上参数 1 开启严格模式。

import fast_cleaner

spanish_text = "¡Hola, amigo! ¿Cómo estás?"

# 默认模式(普通清洗)
print(fast_cleaner.clean(spanish_text))
# 输出: ¡Hola amigo ¿Cómo estás

# 严格模式
print(fast_cleaner.clean(spanish_text, 1))
# 输出: Hola amigo Cómo estás

⚡ 为什么用它?

因为快。底层全部由 C 语言实现,直接操作内存,没有 Python 原生字符串处理的性能损耗,清洗上亿字符只需眨眼之间。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fast_cleaner-0.1.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fast_cleaner-0.1.0-cp313-cp313-win_amd64.whl (6.8 kB view details)

Uploaded CPython 3.13Windows x86-64

File details

Details for the file fast_cleaner-0.1.0.tar.gz.

File metadata

  • Download URL: fast_cleaner-0.1.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for fast_cleaner-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e85a355fb8371d457066fa85309a3f6a9a57442afc70c8a094459c94840b109f
MD5 720b7d67642e396af4d016ac0f07e002
BLAKE2b-256 b6286380003e886a434caa8b25b9fb27ae183719452c0de35d75cfdcefd43573

See more details on using hashes here.

File details

Details for the file fast_cleaner-0.1.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for fast_cleaner-0.1.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 d84d0860eaff0d9435c9f7ba38fe812c1709e66309d8340d803c6ff7a11af56f
MD5 a3c5935cdaab47c257e14a8c10e227b8
BLAKE2b-256 6855bcb9ab3715212e8a48e6548fbf39cf7f29f9e3cf42ec5175436261cd3335

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page