Giter VIP home page Giter VIP logo

preprocessing_for_social_media's Introduction

Preprocessing Social Media Text

This Python script provides functions to preprocess social media text, specifically Reddit and StackOverflow posts, as well as Twitter text.

Installation

This script requires Python 3 and the re module. There are no additional dependencies.

Usage

To use this script, first import it in your Python code:

from preprocessing import preprocess

Then, call the preprocess() function with the text you want to preprocess as the argument. By default, the function assumes the text is Twitter text, but you can set the is_twitter argument to False if you are preprocessing Reddit or StackOverflow posts:

text = 'RT @user: This is a test tweet with a link https://t.co/123456 and an emoji ๐Ÿ˜‚'
emojis, preprocessed_text = preprocess(text)

The function returns a tuple containing two items:

  1. A string containing all extracted emoji characters separated by spaces.
  2. The preprocessed text.

Functionality

extract_emoji()

Extracts all emoji characters from the text.

emojis = extract_emoji(text)

remove_markdown()

Removes markdown formatting and symbols from the text.

preprocessed_text = remove_markdown(text)

remove_twitter()

Removes Twitter-specific symbols from the text.

preprocessed_text = remove_twitter(text)

preprocess()

Preprocesses social media text by first extracting all emoji characters, then removing markdown formatting and symbols, and finally removing Twitter-specific symbols (if is_twitter is set to True).

emojis, preprocessed_text = preprocess(text, is_twitter=True)
@misc{preprocess,
  title = {Preprocessing Social Media Text},
  author = {Heng Ee Tay},
  year = {2023},
  howpublished = {GitHub repository},
  url = {https://github.com/hengee/preprocessing_for_social_media},
  type = {python source code}
}

preprocessing_for_social_media's People

Contributors

hengee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.