Skip to main content

An open-source Python library for CLI and NLP tasks

Project description

nlpfileio

An open-source Python CLI tool for NLP tasks

nlpfileio is a command-line interface library that simplifies natural language processing (NLP) tasks such as removing stopwords, normalizing text, stemming, and sentiment analysis.
It is built with Click and provides an interactive, colorful CLI with configuration support.


โœจ Features

  • ๐Ÿ“ Stopword Removal โ€” Remove stopwords using spaCy or TextBlob.
  • ๐Ÿ”„ Text Normalization โ€” Clean and normalize sentences.
  • ๐ŸŒฑ Stemming โ€” Perform stemming on sentences.
  • ๐Ÿ˜Š Sentiment Analysis โ€” Get polarity & subjectivity for each sentence.
  • โš™๏ธ Configurable โ€” Supports config.ini for default settings.
  • ๐ŸŽจ Interactive CLI โ€” Colorful, user-friendly prompts.

๐Ÿ“ฆ Installation

Install from PyPI (after publishing):

pip install nlpfileio

Then, download the required NLP resources (must be done once before first use):

nlpfileio-download

Or install from source:

git clone https://github.com/Ahmadzadeh920/nlpcli-pakage-library.git
cd nlpcli-pakage-library
pip install .

โšก Usage

The CLI tool is available as nlpfileio once installed.

Note: Before using nlpfileio for the first time, you must download the necessary NLP models and resources. Run:

  nlpfileio-download

Run it with an input file (.csv or .txt):

nlpfileio input.txt

๐Ÿ›  Commands

1. Remove Stopwords

nlpfileio input.txt remove_stop_words

Removes stopwords and shows an example. Optionally save results.

2. Normalize Sentences

nlpfileio input.txt normalize

Normalizes text and saves to normalized_sentences.txt if desired.

3. Stem Sentences

nlpfileio input.txt stem

Applies stemming. Example and optional file export included.

4. Sentiment Analysis

nlpfileio input.txt sentiment

Computes sentiment for each sentence:

Sentence: I love open-source projects.
Polarity: 0.500, Subjectivity: 0.600

Exports results to sentiments_sentences.txt if selected.


๐Ÿ“‚ Project Structure

nlpfileio/
โ”œโ”€โ”€ src/nlpclinlpfileio/
โ”‚   โ”œโ”€โ”€ cli.py          # CLI entry point
โ”‚   โ”œโ”€โ”€ services.py     # Core NLP functions
โ”‚   โ”œโ”€โ”€ config.ini      # Default configuration
โ”‚   โ””โ”€โ”€ __init__.py
โ”œโ”€โ”€ tests/              # Unit tests
โ”œโ”€โ”€ README.md           # Documentation
โ”œโ”€โ”€ pyproject.toml      # Project metadata
โ””โ”€โ”€ poetry.lock

โš™๏ธ Configuration

Default options can be stored in config.ini, automatically loaded by the CLI.

Example:

[settings]
language = en
output_format = txt

๐Ÿงช Development

Clone and install dependencies:

poetry install

Run tests:

poetry run pytest

๐Ÿš€ Roadmap

Planned features and improvements:

  • Lemmatization โ€” Add support for lemmatizing words.
  • Language Detection โ€” Automatically detect the language of input text.
  • Additional Input Formats โ€” Support JSON, Excel, and other file types.
  • Enhanced Visualization โ€” Use rich for better CLI output formatting.

๐Ÿ“œ License

This project is licensed under the MIT License


๐Ÿ‘ฉโ€๐Ÿ’ป Author

Fatemeh Ahmadzadeh

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

nlpfileio-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

nlpfileio-0.1.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file nlpfileio-0.1.1.tar.gz.

File metadata

  • Download URL: nlpfileio-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.10.12 Linux/6.8.0-79-generic

File hashes

Hashes for nlpfileio-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9d1f20728b5cb08d57e53dff5dd971efd5e9e020f0e2f770047d34934cd40279
MD5 08c21b14742ade9ca881090b414ca730
BLAKE2b-256 9da2cdb376226bb010df5d362a8a17da00343f3e54adde9a0fa64a0156a47165

See more details on using hashes here.

File details

Details for the file nlpfileio-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: nlpfileio-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.10.12 Linux/6.8.0-79-generic

File hashes

Hashes for nlpfileio-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5feece1225034bef9345fe0edd2d6e0ac97a1ffb19af41924e1f7f3c42c8d9bb
MD5 c0064d25456935067cf3ee629708182e
BLAKE2b-256 9c2426a090395498820d9423b33ae30438d636ca9f4e877f6cd85e4daf6a907d

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