Skip to content
Textpipe: clean and extract metadata from text
Branch: master
Clone or download
dependabot-bot and anneschuth Update pytest requirement from ~=4.1.1 to ~=4.2.1
Updates the requirements on [pytest]( to permit the latest version.
- [Release notes](
- [Changelog](
- [Commits](pytest-dev/pytest@4.1.1...4.2.1)

Signed-off-by: dependabot[bot] <>
Latest commit acbccc7 Feb 18, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
textpipe remove assert statement Jan 14, 2019
.gitignore Adds virtualenv stuff to .gitignore Aug 7, 2018
LICENSE Update LICENSE Jul 4, 2018 Update with style improv Jan 14, 2019
VERSION Bump version Jan 14, 2019
test-requirements.txt Update pytest requirement from ~=4.1.1 to ~=4.2.1 Feb 18, 2019

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.



  • 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
You can’t perform that action at this time.