Skip to content

Examples

lare edited this page Jan 13, 2025 · 16 revisions

Examples

Cleaning a body of text mined from an API

In this short example, we will be looking at cleaning a body of text mined from an API, to prepare your text for further processing and feature engineering like Sentiment Analysis etc. With cleantweet, it is easy to clean a body of text with just a few lines of code:

Install the cleantweet library

!pip install cleantweet

Import the cleantweet library

import cleantweet as clt

Create an instance of the CleanTweet class

data = clt.CleanTweet('mini corpus for testing')

Call the clean() method on the object

data = data.clean()

View the cleaned body of text

print(data)

Clone this wiki locally