GithubHelp home page GithubHelp logo

atmarges / pinoy_tweetokenize Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 69 KB

A modified version of [tweetokenize](https://github.com/jaredks/tweetokenize) designed for tokenizing Philippine tweets.

Python 100.00%
tokenizing-philippine-tweets tweets nlp machine-learning

pinoy_tweetokenize's Introduction

Pinoy Tweetokenize

A modified version of tweetokenize designed for tokenizing Philippine tweets.

Modifications made includes:

  • Code updated from Python 2 to Python 3
  • Hashtags containing camelcase letters are split into separate tokens. For instance, "#HomeSweetHome" is converted into ['#', 'home', 'sweet', 'home']. Hashtags that don't use camelcase are converted into a single token without the # symbol.
  • One unique feature of Tagalog as compared to English is the use of repeating syllables. This allows the speaker to indicate the tense of the verb being used (i.e. maglaba to maglalaba). Elongating some of the syllables of words can indicate expressing a strong emotion (i.e. hehe to hehehehehehe). However, to shorten word count, a limitation was set limiting the maximum number of repeating syllables to three.
  • Each emoji is considered to be a separate token.
  • A file named 'emojis.txt' is included inside the lexicon folder. This makes adding new emoji for token filtering easier.
  • A method for tokenizing a set of tweets is included

Usage

from tweetokenize.tokenizer import Tokenizer

tweets = [
    "Ang dami kong kailangang gawin ngayong araw... :(",
    "Salamat at gumana din. Kapagod... ๐Ÿ˜ซ",
    "Thank you Lord. Natapos ko din lahat ng homeworks. ๐Ÿ™๐Ÿ˜Š",
]

# Create Tokenizer instance
tokenizer = Tokenizer()

# Test tokenize() method
tokens = tokenizer.tokenize(tweets[1])
output = ', '.join(tokens)
print(output.encode('utf-8'))  # Can't print on console unless encoded to utf-8

# Test tokenize_set() method
tokens_set = tokenizer.tokenize_set(tweets)
output = [', '.join(i) for i in tokens_set]
for i in output:
    print(i.encode('utf-8'))

pinoy_tweetokenize's People

Contributors

atmarges avatar

Watchers

 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.