Giter Club home page Giter Club logo

perplexicon's Introduction

Perplexicon / Perplexicon

A simple but capable system for making conlang lexicons.

What Makes it Special

The way Perplexicon will function is so easy that anyone could figure it out. Simply update a single JSON file with new words and you will immediately be able to export them to as many filetypes as you want. Perplexicon is built with languages where one word can function as multiple parts of speech and/or has different meanings in different contexts in mind, but that doesn't have to be the case -- Perplexicon works just as well with languages where there is one word for every meaning.

I have included two sample lexicons from conlangs I've made before. Sajem Tan (sajem_tan.json) is a language that has all of the traits listed above. In this dictionary are three words that have several different definitions. Some of them need context to make sense due to them being inside jokes, but it's really just a technical demo to test whether the multiple definitions system works. Ki*iul (kiiul.json) is a language where none of these features apply. It's just to show that it works with languages that have one definition per word too.

List of Features:

  • Ability to specify more than one definition and part of speech for a word/term
  • Command line interface
    • Opens lexicons
    • Looks up certain definitions
    • Edits lexicons
    • Outputs to file
  • Graphical interface
  • Multiple styles for definitions
  • Abbreviations for parts of speech
  • Alphabetizing lexicons
  • IPA Support
  • Clean Python code

How It Works

I'll have a better documentation later, but for now, here's how it works.

Lexicon Files

You'll need to make yourself a lexicon file. The way you do this is by copying this simple template:

{
    "poses": [

    ]
    "terms": [

    ]
}

Adding Parts of Speech

Within the pos array, you can define different parts of speech and how to abbreviate them. For each part of speech add:

{"pos": "PART OF SPEECH", "abbr": "ABBREVIATION"}

For example, if you want to abbreviate "noun" to "n.", type:

{"pos": "noun", "abbr": "n."}

Adding Terms

Terms are any morpheme that can be used. Put these in the terms array. Add:

{"term":"TERM", "defs":[["PART OF SPEECH 1", "DEFINITION 1", "DEFINITION 2"], ["PART OF SPEECH 2", "DEFINITION 3", "DEFINITION 4"]]}

If the term can't function as more than one part of speech, get rid of the second chunk. If it has five parts of speech that it can function as, add a few more blocks. If the term only has one definition, get rid of one of them. If it has ten, add more. It's super easy to make a lexicon file that is both readable and extensible.

For example, if parecer is the verb for "to seem", you'd add this:

{"term":"parecer", "defs":[["verb", "to seem"]]}

But, if it can also mean "to look" and "to appear" you would add them as such.

{"term":"parecer", "defs":[["verb", "to seem", "to look", "to appear"]]}

If it can also be used to mean "opinion", then:

{"term":"parecer", "defs":[["verb", "to seem", "to look", "to appear"], ["noun", "opinion"]]}

Command Line

Open up a command window in your working directory. Different parameters change what happens.

You type: What happens:
python print_lex.py Error telling you that you need a lexicon file.
python print_lex.py lexicon.json Prints every entry in lexicon.json.
python print_lex.py lexicon.json -q uk Prints every entry in lexicon.json where the term contains "uk".
python print_lex.py lexicon.json -q uk -m term Prints the entry in lexicon.json that the term is "uk" (See Search Methods below.
python print_lex.py lexicon.json -t html Prints every entry in lexicon.json using template HTML (See Templates below.
python print_lex.py lexicon.json -o output.txt Prints every entry in lexicon.json to the file output.txt

Search Methods

When searching for specific terms, there are different ways to get that information.

Method Explanation
term Returns the entry where the term exactly matches the query.
index Returns the entry at the specified position.
term-part Returns any entry where the term contains the query.

Templates

Perplexicon comes with several different templates from which to choose. These have no functional purpose, but they are useful when exporting to other filetypes.

Template Explanation
default Completely normal template.
html Adds HTML tags to the default template.
latex Uses same styling as html, but for LaTeX.
multiline Prints each definition on a separate line.
multiline-html Prints each definition on a separate line in HTML.
webster Built to mimic the style Merriam-Webster uses for their dictionaries.
webster-html Like webster but with HTML tags.

perplexicon's People

Contributors

codetriangle avatar

Stargazers

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

Watchers

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