Coder Social home page Coder Social logo

elixir_wordsets's Introduction

Overview

This Elixir program implements a parallelized algorithm to discover word combinations that, when written on separate lines, read the same both horizontally and vertically. For example:

J O S H
O B O E
S O F A
H E A D

Read an article about this program on my blog.

How to run the program

Assuming you have Elixir installed, open Terminal in this project's root directory and load its mix.exs file into the interactive Elixir console (IEx):

$ iex -S mix

Next set up the processing environment…

iex(1)> Wordsets.init  # initialize the Lexicon and Cache processes 
Loading words…
Indexed lexicon in 6.7 seconds.
:ok

Now search for wordsets that start with a certain word, such as elixir.

iex(2)> Wordsets.find "elixir"                                     
elixir
lately
itonia
xenian
iliahi
ryania

elixir
linene
inanga
xenial
ingate
reales

found 2 in 0.774412 seconds
:ok

Replace "elixir" with any word you like. Be aware, finding all available wordsets for some words is very fast, but for other words it can take a few seconds. I heavily optimized the search algorithm (see the Engine module) and data model (see the Lexicon module), but natural language is inherently irregular.

Compatibility

This program has only been tested on OS X. Its source of words is the file /usr/share/dict/words which is included in the operating system installation by default. Windows users will need to download the file and adjust the @file_path value in lexicon.ex.

The code was written and tested with Elixir v1.0.3

elixir_wordsets's People

Contributors

ijoshsmith avatar

Watchers

johan pretorius avatar James Cloos avatar  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.