Observed since 21 Oct, 10:39 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
Set of NLP preprocessing techniques with the aim of abstracting data preparation processes, in addition to performing validations and cleaning the masses.
The single label format is designed for datasets where each document is associated with a single class. The CSV file must adhere to the following structure:
| tag | text |
|---|---|
| CLASS | Text of document 1 |
| CLASS | Text of document 2 |
| CLASS | Text of document 3 |
Each row in the CSV file corresponds to a single document and its associated class. The CSV must contain exactly two columns: the first column for the class and the second column for the text of the document.
The multi label format is intended for datasets where each document can be associated with multiple classes. The CSV file must follow this structure:
| tag | text |
|---|---|
| CLASS | Text of document 1 |
| CLASS|CLASS|CLASS | Text of document 2 |
| CLASS|CLASS | Text of document 3 |
| character.Each row in the CSV file corresponds to a single document and its associated classes. The CSV must contain exactly two columns: the first column for the classes and the second column for the text of the document. For multi-label documents, multiple classes must be separated by the | character with no leading or trailing | characters.
greeting,"Hello!"
greeting,"Good morning!"
question,"How are you?"
greeting,"Hello!"
greeting|question,"Hi, how are you?"
question|feedback,"What do you think of this service?"
tag column must contain only one class per row. No | character should be present.tag column can contain multiple classes separated by |. Ensure there are no empty classes and no leading or trailing | characters.Tokenizes text data and prepares it for training a neural network model.
The input textual data is tokenized, i.e., split into individual words or tokens. This is done using the spaCy library, which provides robust linguistic annotations.
Text sequences are padded to ensure uniform length. This is necessary for feeding the data into a neural network, as they typically require fixed-size inputs. Padding is done using the Keras pad_sequences function.
If the labels are categorical, they are encoded using either LabelEncoder or MultiLabelBinarizer from the scikit-learn library. This step converts textual labels into numerical representations, which are easier for the neural network to process.
Optionally, the preprocessed data can be split into training and testing sets using train_test_split from scikit-learn. This facilitates model evaluation by providing a separate dataset for testing.
data_frame (pandas.DataFrame): The input DataFrame containing 'text' and 'tag' columns.max_length (int): Maximum length of sequences after padding. (Important! Critical variable, depending on the value entered, can cause erroneous operation, disrupting tokenization, occurs mainly when using low values, to avoid using values above 100)split_test_size (float, optional): Size of the test dataset if splitting is needed. Defaults to None.remove_stop_words (bool, optional): Whether to remove stop words. Defaults to False.remove_punctuation (bool, optional): Whether to remove punctuation. Defaults to False.language (str, optional): Language to be used for tokenization. Defaults to "portuguese".tuple: If the split_test_size parameter is passed, the separation into training and test masses will be done and it will return the following results:
X_train, X_test, y_train, y_test, word_index
If split_test_size=False, it would return the datasets only from the tokenization of the texts, the labels will be hidden and the word index will be returned:
X, y, word_index
Download counts and popularity will appear here as the collector receives them.
| Version | Published | Direct dependencies | Open version |
|---|---|---|---|
| 1.0.1 | 7 Jun 2024 | 0 |
This describes our collected data; it is not a security assessment.
Shared repository data · GitHub
Observed since 21 Oct, 10:39 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package:f0b155f04d36263f8ae0a4f9079feab4e618e879ce3024a68684cae19b9f57d8