Giter Club home page Giter Club logo

orlando's Introduction

Orlando

Because, what's in a name...

What's are we doing today, Brain?

Objective

By learning from a specialised corpus of input text, we can start to predict what the next word in a sentence (for this type of text) might be.

This is useful for

  • word-prediction on mobile devices;
  • text generator, see if it makes sense;
  • assessing likelyhood of text having same author as other texts.

Why

It's a neat exercise in linguistics, maths and learning algorithms. Contrary to many learning systems which operate in an opaque manner, the specialised approach here can be easily followed and verified.

And yes, modern AI are "smarter", but... Orlando's approach still works better than the word prediction used in most mobile phones! Einstein noted: "Make things as simple as possible, but no simpler." That ALSO means, don't make things more complicated than needed for its purpose! No need to connect to the cloud for SMS word prediction. And really, Orlando uses a simple ML model. ML is not magic.

How

Words and punctuation are mapped to a dynamic token dictionary. (we try to identify things like initials, email and URLs as tokens)

We create a frequency network based on trigrams (A,B,C) of tokens:

  1. STX STX The
  2. STX The quick
  3. The quick brown
  4. quick brown fox

In practice, for each token(A,B), we track the frequency of token(C). Then, the RELATIVE frequency of ALL occurring token(C) after token(A,B) allows us to derive the probability of ANY ONE token(C) following (A,B).

Structure

We could visualise our structure in a 3D token matrix of size N^3, however, let's not waste daft amounts of memory: it'd turn out to be a sparse matrix. So we set up a different structure: we'll use a token hash array + a binary tree for the trigrams with the token(C) part in a linked list. A neat exercise in good old common C structures, really :)

-- Arjen Lentz, 2019

References

orlando's People

Contributors

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