Skip to main content

textpipe: clean and extract metadata from text

Project description

Build Status Codacy Badge

textpipe: clean and extract metadata from text

textpipe is a Python package for converting raw text in to clean, readable text and extracting metadata from that text. Its functionalities include transforming raw text into readable text by removing HTML tags and extracting metadata such as the number of words and named entities from the text.

Vision: the zen of textpipe

  • Designed for use in production pipelines without adult supervision.
  • Rechargeable batteries included: provide sane defaults and clear examples to adapt.
  • A uniform interface with thin wrappers around state-of-the-art NLP packages.
  • As language-agnostic as possible.
  • Bring your own models.


  • Clean raw text by removing HTML and other unreadable constructs
  • Identify the language of text
  • Extract the number of words, number of sentences, named entities from a text
  • Calculate the complexity of a text
  • Obtain text metadata by specifying a pipeline containing all desired elements
  • Obtain sentiment (polarity and a subjectivity score)
  • Generates word counts
  • Computes minhash for cheap similarity estimation of documents

Usage example

>>> from textpipe import doc, pipeline
>>> sample_text = 'Sample text! <!DOCTYPE>'
>>> document = doc.Doc(sample_text)
>>> print(document.clean)
'Sample text!'
>>> print(document.language)
>>> print(document.nwords)

>>> pipe = pipeline.Pipeline(['CleanText', 'NWords'])
>>> print(pipe(sample_text))
{'CleanText': 'Sample text!', 'NWords': 2}

In order to extend the existing Textpipe operations with your own proprietary operations;

test_pipe = pipeline.Pipeline(['CleanText', 'NWords'])
def custom_op(doc, context=None, settings=None, **kwargs):
    return 1

custom_argument = {'argument' :1 }
test_pipe.register_operation('CUSTOM_STEP', custom_op)
test_pipe.steps.append(('CUSTOM_STEP', custom_argument ))


See CONTRIBUTING for guidelines for contributors.



  • Raise TextpipeMissingModelException instead of KeyError


  • Bumps spaCy and datasketch dependencies


  • Replaces codacy with pylint on CI
  • Fixes pylint issues


  • Adds wrapper around Gensim keyed vectors to construct document embeddings from Redis cache


  • Adds functionality to compute document embeddings using a Gensim word2vec model


  • Removes non standard utf chars before detecting language


  • Bump spaCy to 2.1.3


  • Fix broken install command


  • Fix broken install command


  • Fix copy-paste error in word vector aggregation (#118)


  • Fixes bugs in several operations that didn't accept kwargs


  • Bumps Spacy to 2.1


  • Pins Spacy and Pattern versions (with pinned lxml)


  • change operation's registry from list to dict
  • global pipeline data is available across operations via the context kwarg
  • load custom operations using register_operation in pipeline
  • custom steps (operations) with arguments

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for textpipe, version 0.11.5
Filename, size File type Python version Upload date Hashes
Filename, size textpipe-0.11.5.tar.gz (35.4 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page