Skip to main content

A ML preprocessing library.

Project description

lib_ml_remla_team14_a2

lib_ml_remla_team14_a2 contains pre-processing logic for data used in our ML training pipeline.

Features

  • Tokenization of text data at a character level.
  • Padding of text sequences to uniform lengths.

Installation

Install lib_ml_remla_team14_a2 using pip:

pip install lib_ml_remla_team14_a2

Usage

Importing the Class

from lib_ml.preprocessing import TextPreprocessor

Initializing the Preprocessor'

You can customize the behavior of the TextPreprocessor by adjusting its configuration. Here's how to initialize it with the default settings:

preprocessor = TextPreprocessor()

Or customize its behavior:

config = {
    'lower': True,
    'char_level': True,
    'oov_token': '-n-',  # Token used for out-of-vocabulary characters
    'sequence_length': 150  # Adjust sequence length as needed
}
preprocessor = TextPreprocessor(config=config)

Preprocessing Text Data

Use the fit_text method to fit the tokenizer on your text data, and transform_text to convert text data into padded sequences:

texts = ["hello", "world"]
preprocessor.fit_text(texts)
processed_texts = preprocessor.transform_text(texts)

Output

The transform_text method returns an array of tokenized and padded sequences, ready for use in training or inference:

print(processed_texts)  # Output will be a NumPy array of processed text 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

lib_ml_remla_team14_a2-1.0.14.dev0.tar.gz (84.8 kB view details)

Uploaded Source

Built Distribution

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

lib_ml_remla_team14_a2-1.0.14.dev0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file lib_ml_remla_team14_a2-1.0.14.dev0.tar.gz.

File metadata

File hashes

Hashes for lib_ml_remla_team14_a2-1.0.14.dev0.tar.gz
Algorithm Hash digest
SHA256 54491b7e54b98b68bab30b2b725f2831e3149495f471fa84d968ac662b37c767
MD5 3830f4ed8f02a21dddb5348bb939dcc1
BLAKE2b-256 7f8dd6809774c969883e998b775e34893618bd0c30722c5361b679e2473f3016

See more details on using hashes here.

File details

Details for the file lib_ml_remla_team14_a2-1.0.14.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for lib_ml_remla_team14_a2-1.0.14.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 a4a37cb9451b4fc22ed8603a2cbb235e5e93e63002b62468403c3c9ae765ceb7
MD5 29ae9205f04283623e4aebbbb3911d93
BLAKE2b-256 75b1d01c0b352cb4fa09e10766db40ab0207545857b7eefaa240b12da2f78e8d

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