Skip to main content

Text Classification with TensorFlow

Project description

NLPipes

A Tensorflow Library for Text Classification


Table of Contents
  1. Overview
  2. How to Use

Overview

NLPipes is a Tensorflow library that provides an easy way to train and use deep-learning based models for a diversity of text classification tasks.

NLPipes supports the following tasks:

  • Mono-label classification: Assign one label to each text (e.g. positive, neutral, negative).
  • Multi-label classification: Assign one or more label to each text from a list of possible classes (e.g., Product Category, Product Quality, Delivery Time, and Price)
  • Class-label classification: Assign one label from a list of possible labels for each of a list of classes. A typical use case is aspect based sentiment analysis where one want to detect each aspect mentionned in a review along his assocated sentiment polarity.

Built with

NLPipes is built with TensorFlow and HuggingFace Transformers:

  • TensorFlow: An end-to-end open source deep learning framework
  • Transformers: An general-purpose open-sources library for transformers-based architectures

How To Use

NLPipes provides high level abstractions to save having to deal with the complexity of deep-learning based Natural Language Understanding algorithms.

Mono-label classification

Give NLPipes a single label for each text as a target.

from nlpipes import Model

model = Model(task = 'mono-label-classification',
              name_or_path = 'bert-base-uncased')

reviews   = ["text", "text", "text", ...]
sentiments = ["positive", "negative", "neutral", ...]

test_reviews = ["text", "text", "text", ...]
test_sentiments = ["positive", "negative", "neutral", ...]

new_reviews = ["text", "text", "text", ...]

model.train(reviews, sentiments)

evaluation = model.evaluate(test_reviews, test_sentiments)

predictions = model.predict(new_reviews)
 
model.save('./sentiment_detection_model')

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

nlpipes-0.1.0.tar.gz (32.0 kB view hashes)

Uploaded Source

Built Distribution

nlpipes-0.1.0-py3-none-any.whl (41.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page