GithubHelp home page GithubHelp logo

asy3661 / latin-case-generator Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5.81 MB

An attempt to train a neural network to generate the right case of a Latin or Greek word, given a preposition and a noun stem.

License: MIT License

Python 100.00%

latin-case-generator's Introduction

Latin Case predictor

This repository contains a character-based LSTM language model used to see how well the model can generate Latin case endings, depending on several factors. The data is formatted in a column where the first word is a preposition and the second word is a noun. Latin prepositions select for nouns in certain cases, and the form of the case is dependent on the declension of the noun, so ideally the model would be able to learn two primary aspects about the data:

  • The selected case given a particular preposition (some prepositions select multiple cases)
  • the correct suffix form given a particular case and declension

Much of the model was taken directly from Aladdin Persson's Github repository for generating baby names.

The data came from the CLTK Tesserae Latin Corpus, and was parsed with CLTK to find examples of adjacent preposition and noun pairs.

Architecture

This model has two layers of LSTMs with 256 hidden nodes and is trained with Adam.

Methods

The neural network can be accessed with the Generator class of model.py. There is a pretrained model in the repo, case_predictor.pt, which can be loaded with the Generator.load_model function. To test the model, there are the following methods:

  • Generator.generate: this will produce strings of n length, including whitespace. It emulates the data/data.txt file.
  • Generator.complete_string: this function will replicate one line from the data/data.txt file. For probing the current research question, it works best for the input to the function to be a string that has a latin preposition followed by a noun stem, e.g., in insul, for the word in insula 'on the island.'
  • Generator.estimate_prob_dist: This runs Generator.complete_string 1000 times, counting each form that is produced and returning a collections.Counter object. This allows us to estimate the probability distribution of what forms will be outputted by the network.
  • Generator.random_prediction: This function randomly chooses a preposition and feeds it into the Generator.complete_string function. This could be used to learn about frequencies of which nouns will be output.

latin-case-generator's People

Contributors

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