Importable modules for learning machine learning and deep learning.
Project description
ai-starter-kit
Importable boilerplate for machine learning / deep learning projects — reusable code wrapped around common libraries (like NLTK) so you don't have to rewrite the same setup every time. Install it, import what you need.
Install
pip install ai-starter-kit
Available modules
| Module | Description |
|---|---|
ask.text |
Chains common NLP preprocessing steps (lowercasing, noise/punctuation removal, tokenization, stopword removal, stemming, lemmatization) behind a fluent, resettable TextProcessor API using NLTK. |
More modules will be added as the project grows.
Text Processing
Each preprocessing step is a method on TextProcessor that returns self, so they can be called individually, one at a time, or chained together in a single fluent pipeline:
from ask.text import TextProcessor, PartOfSpeech
tp = TextProcessor([
"Running, runners ran quickly through the running trails.",
"Check out <b>this</b> amazing offer at https://example.com!! Call 12345 now.",
])
By default, constructing a TextProcessor downloads the NLTK data it needs (punkt, punkt_tab, stopwords, wordnet) the first time, which requires network access and can be slow — or fail outright in offline/sandboxed environments. Pass auto_download=False to skip this (e.g. if you've already fetched the data yourself via nltk.download(), or don't need methods that depend on it).
Individually, one step at a time, resetting back to the original input between each:
tp.reset().tokenize()
tp.reset().to_lowercase().tokenize()
tp.reset().remove_punctuation().tokenize()
tp.reset().tokenize().remove_stopwords()
tp.reset().remove_noise().tokenize()
tp.reset().tokenize().stem()
tp.reset().tokenize().lemmatize(pos=PartOfSpeech.Noun)
Or chained together as a full preprocessing pipeline:
tp.reset().to_lowercase().remove_noise().remove_punctuation().tokenize().remove_stopwords().lemmatize(pos=PartOfSpeech.Verb)
print(tp.tokens)
# [['run', 'runners', 'run', 'quickly', 'run', 'trail'], ['check', 'amaze', 'offer', 'call']]
Methods
TextProcessor holds two pieces of state: .sentences (a list of strings) and .tokens (a list of word lists, populated by .tokenize()). Most methods work on one or the other, and .remove_stopwords(), .stem(), and .lemmatize() require .tokenize() to have been called first — call them too early and they raise ValueError.
| Method | Operates on | Description |
|---|---|---|
to_lowercase() |
.sentences |
Lowercases every sentence. |
remove_noise(html=True, urls=True, numbers=True, special_chars=True) |
.sentences |
Strips HTML tags, URLs, digits, and/or non-letter characters. Each kind of noise can be toggled off. |
remove_punctuation() |
.sentences |
Strips punctuation from each sentence. |
tokenize() |
.sentences → .tokens |
Splits each sentence into a list of word tokens. |
remove_stopwords() |
.tokens |
Drops common stopwords (e.g. "the", "a") from each token list. |
stem() |
.tokens |
Reduces each token to its word stem (Porter stemmer). |
lemmatize(pos=PartOfSpeech.Verb) |
.tokens |
Reduces each token to its dictionary form for the given part of speech. |
reset() |
both | Restores .sentences to the original constructor input and clears .tokens. |
PartOfSpeech is an enum with Noun, Verb, Adjective, and Adverb — pass one to lemmatize(pos=...) to control how words are reduced.
Development
To set up a local environment for running the test suite:
# Windows
powershell -ExecutionPolicy Bypass -File .\scripts\bootstrap.ps1
# macOS/Linux
./scripts/bootstrap.sh
This creates a .venv, installs the package in editable mode, and pulls in dev/test dependencies (nltk, pytest). Then activate it and run the tests:
# Windows
. .\.venv\Scripts\Activate.ps1
pytest -v
# macOS/Linux
source .venv/bin/activate
pytest -v
Contributing
New modules are welcome. Add a package under src/ask/<name>/, cover it with tests, then open a PR.
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_starter_kit-0.3.1.tar.gz.
File metadata
- Download URL: ai_starter_kit-0.3.1.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c24998065c74d8acfb0de77d15c66e789bfcf7a7a3270d6b57daab0118e26c2
|
|
| MD5 |
dc076b87ffbfd6d01c30bad566c885c3
|
|
| BLAKE2b-256 |
809231b6b4ce78c3dc48171c38218276d310adcab5473e329d83e011b3f2ee97
|
Provenance
The following attestation bundles were made for ai_starter_kit-0.3.1.tar.gz:
Publisher:
release.yml on mikovilla/ai-starter-kit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_starter_kit-0.3.1.tar.gz -
Subject digest:
2c24998065c74d8acfb0de77d15c66e789bfcf7a7a3270d6b57daab0118e26c2 - Sigstore transparency entry: 2213729500
- Sigstore integration time:
-
Permalink:
mikovilla/ai-starter-kit@039ddd9df759c603dd1c0e82dad6e85d6ec408ba -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/mikovilla
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@039ddd9df759c603dd1c0e82dad6e85d6ec408ba -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_starter_kit-0.3.1-py3-none-any.whl.
File metadata
- Download URL: ai_starter_kit-0.3.1-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d100165fa9208b412424dd5f7627cc37d46197fde14543ff03ec98d3b5963f88
|
|
| MD5 |
a6f174b8a8c51e487bc2a9ad84898bec
|
|
| BLAKE2b-256 |
99e96b0339fab28b1248e43970cf1dfcc929bf97836eb61ca87075280ef16e71
|
Provenance
The following attestation bundles were made for ai_starter_kit-0.3.1-py3-none-any.whl:
Publisher:
release.yml on mikovilla/ai-starter-kit
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_starter_kit-0.3.1-py3-none-any.whl -
Subject digest:
d100165fa9208b412424dd5f7627cc37d46197fde14543ff03ec98d3b5963f88 - Sigstore transparency entry: 2213729926
- Sigstore integration time:
-
Permalink:
mikovilla/ai-starter-kit@039ddd9df759c603dd1c0e82dad6e85d6ec408ba -
Branch / Tag:
refs/tags/v0.3.1 - Owner: https://github.com/mikovilla
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@039ddd9df759c603dd1c0e82dad6e85d6ec408ba -
Trigger Event:
push
-
Statement type: