Git Product home page Git Product logo

german-article-guesser's Introduction

Summary

With the code in this project you can train and test a Recurrent Neural Network to try and guess the correct gender of German nouns.

Setup

To run it first you have to download translation data from dict.cc at https://www1.dict.cc/translation_file_request.php?l=e

Then you have to run split_german_train_test.py with the path to the file you downloaded, the output drectory and (optional) the percentage of data for the testing set (int). This script filters out all words that are either not nouns, plural or contain characters that are not a-z, ä, ö, ü and ß. These include apostrophes, hypens, dots, etc. Moreover it removes all words that end with another word, i.e. compound words. This must be done because 1) the gender of a compound word is only determined by the last word and 2) we don't want to have words with the same ending splitted among training and testing set. This will take a while to complete.

Running

After you generated the train and test sets you can run the script german_article_guesser.py that will train a RNN on words in the training file and will test them on words in the testing file.

You can adjust the parameter max_word_length (default: 20) inside german_article_guesser.py: words that are shorter than this number will be padded on the right with '-' to reach the chosen length, words that are longer will be skipped.

With default parameters I reached an accuracy of ~85% on the testing set.

Train and test loss Train and test accuracy

Testing

You can test the trained network on a file or on a list of words with test_words.py

german-article-guesser's People

Contributors

mmoraschini 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.