Skip to main content

Korean profanity filter with morphological analysis (Kiwi + Aho-Corasick)

Project description

nerv-filter

Korean profanity filter with morphological analysis (Kiwi + Aho-Corasick).

⚠️ Status: Alpha — API may change before v1.0

Features

  • 🔤 Kiwi 형태소 분석기 기반 정규화
  • Aho-Corasick 빠른 사전 매칭
  • 📚 7,600+ 변형 사전 패키지 동봉
  • 🎚️ 3단계 보안 수준 (LOW / MEDIUM / HIGH)
  • 사용자 화이트/블랙리스트 동적 갱신
  • 📦 배치 처리 지원

Installation

pip install nerv-filter

Quick Start

from nerv_filter import filter_text

result = filter_text("이 시발 새끼야")
print(result.action)         # ModerationAction.PARTIAL_MASK
print(result.masked_text)    # "이 ** 새끼야"

For repeated use, prefer instance reuse to avoid Kiwi reloading:

from nerv_filter import NervFilter, SecurityLevel

flt = NervFilter(security_level=SecurityLevel.HIGH)

for text in texts:
    result = flt.analyze(text)
    print(result.action, result.masked_text)

Documentation

Development

# Local install
pip install -e ".[dev]"

# Run tests
pytest

# Lint
ruff check src/ tests/

License

This project (nerv-filter) is licensed under MIT — see LICENSE.

Third-Party Dependencies

nerv-filter builds on top of the following open-source libraries, installed via standard pip install as runtime dependencies. Their licenses apply respectively:

Dependency License Source
kiwipiepy LGPL v3 © Minchul Lee (bab2min)
pyahocorasick BSD-3-Clause © Wojciech Muła

LGPL v3 Notice: kiwipiepy is dynamically linked via Python import. Users may replace it with a different version by running pip install kiwipiepy==<version>. The kiwipiepy source code is available at https://github.com/bab2min/kiwipiepy under LGPL v3, and a copy of the license can be obtained at https://www.gnu.org/licenses/lgpl-3.0.html.

This project does not redistribute kiwipiepy code or model data.

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

nerv_filter-0.1.0.tar.gz (44.9 kB view details)

Uploaded Source

Built Distribution

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

nerv_filter-0.1.0-py3-none-any.whl (41.3 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for nerv_filter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9f69deec6759a58bbd6028f6cae0c5338d8b74415a1cb2185536acc402bac3b2
MD5 78027a2692680fb75aed61376961bdd8
BLAKE2b-256 4bcd2753c53d3f720a6de6e6b3f7f5c05557e966adc8833bf8b0b8058f53cb0a

See more details on using hashes here.

File details

Details for the file nerv_filter-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nerv_filter-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 41.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.5

File hashes

Hashes for nerv_filter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 856278d4296a34cfdfd7a993f7e25cd1ded0bc8c77031410d8eebf2491c43a70
MD5 de8b8ffce4c176debd7c38042ecb2538
BLAKE2b-256 fed40e6ff94c7d22362a3c5b0a828a724594d4d5515bb03c07fcd08c99a13e6c

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