Created
September 1, 2011 11:28
-
-
Save hejrobin/1185991 to your computer and use it in GitHub Desktop.
Lexer usage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lex = new Lingo.Lexer(); | |
lex.setLexicon('foo', new Lingo.Dictionary({ | |
name: 'Rövarspråket', | |
description: 'Rövarspråket', | |
lexicon: { | |
characters: { | |
'B': 'Bob', 'b': 'bob', | |
'C': 'Coc', 'c': 'coc', | |
'D': 'Dod', 'd': 'dod', | |
'F': 'Fof', 'f': 'fof', | |
'G': 'Gog', 'g': 'gog', | |
'H': 'Hot', 'h': 'hot', | |
'J': 'Joj', 'j': 'joj', | |
'K': 'Kok', 'k': 'kok', | |
'L': 'Lol', 'l': 'lol', | |
'M': 'Mom', 'm': 'mom', | |
'N': 'Non', 'n': 'non', | |
'P': 'Pop', 'p': 'pop', | |
'Q': 'Qoq', 'q': 'qoq', | |
'R': 'Ror', 'r': 'ror', | |
'S': 'Sos', 's': 'sos', | |
'T': 'Tot', 't': 'tot', | |
'V': 'Vov', 'v': 'vov', | |
'W': 'Wow', 'w': 'wow', | |
'X': 'Sosakoksos', 'x': 'sosakoksos', | |
'Z': 'Zoz', 'z': 'zoz' | |
}, | |
words: { | |
'Tack': 'Totakokkok', 'tack': 'totakokkok', | |
'Sax': 'Sosakoksos', 'sax': 'sosakoksos' | |
}, | |
numbers: {}, | |
special: {} | |
} | |
})); | |
console.log(lex.define('Hotejoj', 'foo')); // >> Hej |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment