Git Product home page Git Product logo

conlangwordgenerator's Introduction

ConlangWordGenerator, v0.3.1

Now it's a gem!

Description

This gem allows the user to generate words for constructed languages, given a LANG file that describes the language. It can also be useful for linguistics to study and generate valid words from a descripted language.

The *.lang file must include sets of phonemes with their individual probability weight, and a grammatical expression, to describe how to generate words for the described language.

Instructions

Usage as a command line executable:

conlang <words count> '<LANG file>'

This command produces an output-<name>.txt file that includes a list of the generated words, separated by newlines.

Usage as a gem:

require 'conlang'

# Path to LANG file, as constructor.
x = WordGenerator.new("tokipona.lang")

# Print ten generated words as
# an array of strings.
p x.get_words(10)

There are *.lang files as examples at lang-examples directory of this project's source.

Custom .lang files

You must create your own .lang files to generate random words for your constructed languages.

There files include a simple lightweight markup language to describe sets of phonemes, their probability, replacements (for exceptions) and a simple regular grammatical expression.

You can learn how to create LANG files here. Again, examples at lang-examples directory can help you a lot.

The class WordGenerator takes a path to a valid *.lang file to produce a generator of words, as described previously in the Instructions section.

Root-level identifiers

  • WordGenerator - Main class
  • ConlangWordGenerator - Namespace module for the gem
  • Exceptions
    • LangFileError < StandardError, for LANG files
    • LangFileIOError < LangFileError
    • LangSyntaxError < LangFileError

conlangwordgenerator's People

Contributors

fluorine avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

babelfish

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.