GithubHelp home page GithubHelp logo

basharourabi / tkseem Goto Github PK

View Code? Open in Web Editor NEW

This project forked from arbml/tkseem

0.0 0.0 0.0 50.83 MB

Arabic Tokenization Library. It provides many tokenization algorithms.

Home Page: https://tkseem.readthedocs.io/en/latest/index.html

License: MIT License

Python 31.49% Jupyter Notebook 68.51%

tkseem's Introduction

tkseem (تقسيم) is a tokenization library that encapsulates different approaches for tokenization and preprocessing of Arabic text.

Documentation

Please visit readthedocs for the full documentation.

Installation

pip install tkseem

Usage

Tokenization

import tkseem as tk
tokenizer = tk.WordTokenizer()
tokenizer.train('samples/data.txt')

tokenizer.tokenize("السلام عليكم")
tokenizer.encode("السلام عليكم")
tokenizer.decode([536, 829])

Caching

tokenizer.tokenize(open('data/raw/train.txt').read(), use_cache = True)

Save and Load

import tkseem as tk

tokenizer = tk.WordTokenizer()
tokenizer.train('samples/data.txt')

# save the model
tokenizer.save_model('vocab.pl')

# load the model
tokenizer = tk.WordTokenizer()
tokenizer.load_model('vocab.pl')

Model Agnostic

import tkseem as tk
import time 
import seaborn as sns
import pandas as pd

def calc_time(fun):
    start_time = time.time()
    fun().train()
    return time.time() - start_time

running_times = {}

running_times['Word'] = calc_time(tk.WordTokenizer)
running_times['SP'] = calc_time(tk.SentencePieceTokenizer)
running_times['Random'] = calc_time(tk.RandomTokenizer)
running_times['Disjoint'] = calc_time(tk.DisjointLetterTokenizer)
running_times['Char'] = calc_time(tk.CharacterTokenizer)

Notebooks

We show how to use tkseem to train some nlp models.

Name Description Notebook
Demo Explain the syntax of all tokenizers.
Sentiment Classification WordTokenizer for processing sentences and then train a classifier for sentiment classification.
Meter Classification CharacterTokenizer for meter classification using bidirectional GRUs.
Translation Seq-to-seq model with attention.
Question Answering Sequence to Sequence Model

Citation

@misc{tkseem2020,
  author = {Zaid Alyafeai and Maged Saeed},
  title = {tkseem: A Tokenization Library for Arabic.},
  year = {2020},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/ARBML/tkseem}}
}

Contribution

This is an open source project where we encourage contributions from the community.

License

MIT license.

tkseem's People

Contributors

zaidalyafeai avatar magedsaeed avatar stichiboi 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.