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-5.0.0.tar.gz (175.2 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-5.0.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file lib_ml_remla_team14_a2-5.0.0.tar.gz.

File metadata

  • Download URL: lib_ml_remla_team14_a2-5.0.0.tar.gz
  • Upload date:
  • Size: 175.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.18

File hashes

Hashes for lib_ml_remla_team14_a2-5.0.0.tar.gz
Algorithm Hash digest
SHA256 3d49d2c690d1ca737811c95d75fe09b6cae80925da47557e744ef53bf959994b
MD5 b64b3d5d688bc2e8523b326c804291bb
BLAKE2b-256 5a0119e7c09631883738503f22098f922425fb6acc9ddba284d503453ef74d8a

See more details on using hashes here.

File details

Details for the file lib_ml_remla_team14_a2-5.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for lib_ml_remla_team14_a2-5.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c05cf5dec237a52e6edd0788aa61f0a7ed5fe6c0490a14ce0510dddb52f2855
MD5 6f0365b7f174ed0edbc5c08e56ac446c
BLAKE2b-256 7955b5007c4dccaac8a690c56e4abaf60b9f14df5f4cd782c34ea725b14a5e1d

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