Giter Club home page Giter Club logo

native_lang_id's Introduction

Native language identification with TensorFlow

Attempt to identify a native language (or country of origin) of a non-native English speaker from their Reddit comments.

The model achieves about 43% accuracy on the provided validation dataset across 47 classes (countries). accuracy

โš ๏ธ In my observation, rather than learning peculiarities of English language usage by a non-native speaker, the model tends to perform classification based on the content of the comments. Training on a larger dataset may improve this.

Training

Training dataset

The included training dataset is taken from this project, which is a scpated Reddit comments from year 2021. This is a rather small dataset of only about a million sentences downloaded from Reddit comments.

A bigger dataset can be found here.

Model

The model is a simple bidirectional LSTM using Bert tokenizer. Input text classification is performed across 47 classes (countries), which are available in the daset.

Running training

Starting training from scratch:

python ./run_training.py

Continue from a checkpoint:

python ./run_training.py <checkpoint file>

Running inference

First you have to prepare inference.yaml configuration file that contains the Reddit API credentials and a reference to the model checkpoint:

user: <Your Reddit user name>
password: <Reddit password>
client_id: <Reddit API client ID>
client_secret: <Reddit API client secret>

checkpoint: <checkpoint name>

Then to run a language identification on a user:

python ./id_reddit_user.py <Reddit user name>

This will download all available comments of the specified Reddit user and run the classification of each comment. The resulting identification is obtained by summing up all the distribution from all the comments, and normalizing the result.

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.