naming-language-generator
v0.8.0
Published
This is code for generating a 'naming language', using the algorithm behind [@unchartedatlas][uncharted]. For more details, see [these notes][notes].
Downloads
2
Readme
Naming language generator
This is code for generating a 'naming language', using the algorithm behind @unchartedatlas. For more details, see these notes.
Classes
Language
A generated language.
Kind: global class
- Language
- new Language()
- new Language()
- .spell() ⇒ String
- .makeSyllable() ⇒ String
- .makeWord(key) ⇒ String
- .getMorpheme(key) ⇒ String
- .getWord(key) ⇒ String
- .getName(key) ⇒ String
- .spell() ⇒ String
- .makeSyllable() ⇒ String
- .makeWord(key) ⇒ String
- .makeMorpheme(key) ⇒ String
- .getMorpheme([key]) ⇒ String
- .getWord(key) ⇒ String
- .makeName(key) ⇒ String
- .translateWord(word) ⇒ String
new Language()
constructor
new Language()
constructor
language.spell() ⇒ String
spell
Kind: instance method of Language
Returns: String - A generated syllable.
language.makeSyllable() ⇒ String
makeSyllable
Kind: instance method of Language
Returns: String - A generated syllable.
language.makeWord(key) ⇒ String
Generate a word from morphemes.
Kind: instance method of Language
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
language.getMorpheme(key) ⇒ String
Gets a morpheme.
Kind: instance method of Language
Returns: String - The generated morpheme.
| Param | Type | | --- | --- | | key | String |
language.getWord(key) ⇒ String
Generates a word.
Kind: instance method of Language
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
language.getName(key) ⇒ String
Generates a name from words.
Kind: instance method of Language
Returns: String - The generated name.
| Param | Type | | --- | --- | | key | String |
language.spell() ⇒ String
spell
Kind: instance method of Language
Returns: String - A generated syllable.
language.makeSyllable() ⇒ String
makeSyllable
Kind: instance method of Language
Returns: String - A generated syllable.
language.makeWord(key) ⇒ String
Generate a new word associated with the key from morphemes. I.e. Create a new coded word for 'city'.
Kind: instance method of Language
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
language.makeMorpheme(key) ⇒ String
Create a new morpheme associated with a key. i.e. land -> [country, land] This would be turned into words later like hillCountry or lakeLand
Kind: instance method of Language
Returns: String - The generated morpheme.
| Param | Type | | --- | --- | | key | String |
language.getMorpheme([key]) ⇒ String
Get a random morpheme associated with the key.
Kind: instance method of Language
Returns: String - The morpheme.
| Param | Type | Default | Description | | --- | --- | --- | --- | | [key] | String | '' | The key to fetch an associated morpheme for. |
language.getWord(key) ⇒ String
Generates a word.
Kind: instance method of Language
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
language.makeName(key) ⇒ String
Generates a name from words.
Kind: instance method of Language
Returns: String - The generated name.
| Param | Type | | --- | --- | | key | String |
language.translateWord(word) ⇒ String
Get the key for which the word was coded. This is not a real translation, but rather the stem concept for a word.
Kind: instance method of Language
Returns: String - The translated word.
| Param | Type | Description | | --- | --- | --- | | word | String | The word to "translate" |
OrthoLanguage ⇐ Language
OrthoLanguage
Kind: global class
Extends: Language
- OrthoLanguage ⇐ Language
- new OrthoLanguage()
- .spell() ⇒ String
- .makeSyllable() ⇒ String
- .makeWord(key) ⇒ String
- .getMorpheme(key) ⇒ String
- .getWord(key) ⇒ String
- .getName(key) ⇒ String
- .makeMorpheme(key) ⇒ String
- .makeName(key) ⇒ String
- .translateWord(word) ⇒ String
new OrthoLanguage()
constructor
orthoLanguage.spell() ⇒ String
spell
Kind: instance method of OrthoLanguage
Overrides: spell
Returns: String - A generated syllable.
orthoLanguage.makeSyllable() ⇒ String
makeSyllable
Kind: instance method of OrthoLanguage
Overrides: makeSyllable
Returns: String - A generated syllable.
orthoLanguage.makeWord(key) ⇒ String
Generate a word from morphemes.
Kind: instance method of OrthoLanguage
Overrides: makeWord
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
orthoLanguage.getMorpheme(key) ⇒ String
Gets a morpheme.
Kind: instance method of OrthoLanguage
Overrides: getMorpheme
Returns: String - The generated morpheme.
| Param | Type | | --- | --- | | key | String |
orthoLanguage.getWord(key) ⇒ String
Generates a word.
Kind: instance method of OrthoLanguage
Overrides: getWord
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
orthoLanguage.getName(key) ⇒ String
Generates a name from words.
Kind: instance method of OrthoLanguage
Returns: String - The generated name.
| Param | Type | | --- | --- | | key | String |
orthoLanguage.makeMorpheme(key) ⇒ String
Create a new morpheme associated with a key. i.e. land -> [country, land] This would be turned into words later like hillCountry or lakeLand
Kind: instance method of OrthoLanguage
Returns: String - The generated morpheme.
| Param | Type | | --- | --- | | key | String |
orthoLanguage.makeName(key) ⇒ String
Generates a name from words.
Kind: instance method of OrthoLanguage
Returns: String - The generated name.
| Param | Type | | --- | --- | | key | String |
orthoLanguage.translateWord(word) ⇒ String
Get the key for which the word was coded. This is not a real translation, but rather the stem concept for a word.
Kind: instance method of OrthoLanguage
Returns: String - The translated word.
| Param | Type | Description | | --- | --- | --- | | word | String | The word to "translate" |
RandomLanguage ⇐ Language
RandomLanguage
Kind: global class
Extends: Language
- RandomLanguage ⇐ Language
- new RandomLanguage()
- .spell() ⇒ String
- .makeSyllable() ⇒ String
- .makeWord(key) ⇒ String
- .getMorpheme(key) ⇒ String
- .getWord(key) ⇒ String
- .getName(key) ⇒ String
- .makeMorpheme(key) ⇒ String
- .makeName(key) ⇒ String
- .translateWord(word) ⇒ String
new RandomLanguage()
constructor
randomLanguage.spell() ⇒ String
spell
Kind: instance method of RandomLanguage
Overrides: spell
Returns: String - A generated syllable.
randomLanguage.makeSyllable() ⇒ String
makeSyllable
Kind: instance method of RandomLanguage
Overrides: makeSyllable
Returns: String - A generated syllable.
randomLanguage.makeWord(key) ⇒ String
Generate a word from morphemes.
Kind: instance method of RandomLanguage
Overrides: makeWord
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
randomLanguage.getMorpheme(key) ⇒ String
Gets a morpheme.
Kind: instance method of RandomLanguage
Overrides: getMorpheme
Returns: String - The generated morpheme.
| Param | Type | | --- | --- | | key | String |
randomLanguage.getWord(key) ⇒ String
Generates a word.
Kind: instance method of RandomLanguage
Overrides: getWord
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
randomLanguage.getName(key) ⇒ String
Generates a name from words.
Kind: instance method of RandomLanguage
Returns: String - The generated name.
| Param | Type | | --- | --- | | key | String |
randomLanguage.makeMorpheme(key) ⇒ String
Create a new morpheme associated with a key. i.e. land -> [country, land] This would be turned into words later like hillCountry or lakeLand
Kind: instance method of RandomLanguage
Returns: String - The generated morpheme.
| Param | Type | | --- | --- | | key | String |
randomLanguage.makeName(key) ⇒ String
Generates a name from words.
Kind: instance method of RandomLanguage
Returns: String - The generated name.
| Param | Type | | --- | --- | | key | String |
randomLanguage.translateWord(word) ⇒ String
Get the key for which the word was coded. This is not a real translation, but rather the stem concept for a word.
Kind: instance method of RandomLanguage
Returns: String - The translated word.
| Param | Type | Description | | --- | --- | --- | | word | String | The word to "translate" |
Random
Random
Kind: global class
- Random
- .shuffle(list) ⇒ Array
- .getRandomFromArray(arr) ⇒ *
- .randomIntBetween(min, max) ⇒ Number
random.shuffle(list) ⇒ Array
Randomize an array
Kind: instance method of Random
Returns: Array - A randomized copy of the original array.
| Param | Type | Description | | --- | --- | --- | | list | Array | The array to randomize. |
random.getRandomFromArray(arr) ⇒ *
Get a random element from the array
Kind: instance method of Random
Returns: * - The random element chosen.
| Param | Type | Description | | --- | --- | --- | | arr | Array | The array to get a random element from. |
random.randomIntBetween(min, max) ⇒ Number
Get a random integer between two numbers.
Kind: instance method of Random
Returns: Number - The random integer.
| Param | Type | Description | | --- | --- | --- | | min | Number | The minimum number to return. | | max | Number | The maximum number to return. |
Language
A generated language.
Kind: global class
- Language
- new Language()
- new Language()
- .spell() ⇒ String
- .makeSyllable() ⇒ String
- .makeWord(key) ⇒ String
- .getMorpheme(key) ⇒ String
- .getWord(key) ⇒ String
- .getName(key) ⇒ String
- .spell() ⇒ String
- .makeSyllable() ⇒ String
- .makeWord(key) ⇒ String
- .makeMorpheme(key) ⇒ String
- .getMorpheme([key]) ⇒ String
- .getWord(key) ⇒ String
- .makeName(key) ⇒ String
- .translateWord(word) ⇒ String
new Language()
constructor
new Language()
constructor
language.spell() ⇒ String
spell
Kind: instance method of Language
Returns: String - A generated syllable.
language.makeSyllable() ⇒ String
makeSyllable
Kind: instance method of Language
Returns: String - A generated syllable.
language.makeWord(key) ⇒ String
Generate a word from morphemes.
Kind: instance method of Language
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
language.getMorpheme(key) ⇒ String
Gets a morpheme.
Kind: instance method of Language
Returns: String - The generated morpheme.
| Param | Type | | --- | --- | | key | String |
language.getWord(key) ⇒ String
Generates a word.
Kind: instance method of Language
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
language.getName(key) ⇒ String
Generates a name from words.
Kind: instance method of Language
Returns: String - The generated name.
| Param | Type | | --- | --- | | key | String |
language.spell() ⇒ String
spell
Kind: instance method of Language
Returns: String - A generated syllable.
language.makeSyllable() ⇒ String
makeSyllable
Kind: instance method of Language
Returns: String - A generated syllable.
language.makeWord(key) ⇒ String
Generate a new word associated with the key from morphemes. I.e. Create a new coded word for 'city'.
Kind: instance method of Language
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
language.makeMorpheme(key) ⇒ String
Create a new morpheme associated with a key. i.e. land -> [country, land] This would be turned into words later like hillCountry or lakeLand
Kind: instance method of Language
Returns: String - The generated morpheme.
| Param | Type | | --- | --- | | key | String |
language.getMorpheme([key]) ⇒ String
Get a random morpheme associated with the key.
Kind: instance method of Language
Returns: String - The morpheme.
| Param | Type | Default | Description | | --- | --- | --- | --- | | [key] | String | '' | The key to fetch an associated morpheme for. |
language.getWord(key) ⇒ String
Generates a word.
Kind: instance method of Language
Returns: String - The generated word.
| Param | Type | | --- | --- | | key | String |
language.makeName(key) ⇒ String
Generates a name from words.
Kind: instance method of Language
Returns: String - The generated name.
| Param | Type | | --- | --- | | key | String |
language.translateWord(word) ⇒ String
Get the key for which the word was coded. This is not a real translation, but rather the stem concept for a word.
Kind: instance method of Language
Returns: String - The translated word.
| Param | Type | Description | | --- | --- | --- | | word | String | The word to "translate" |
Utils
Utils
Kind: global class
- Utils
- .capitalize(word) ⇒ String
- .getRandomFromArray(arr) ⇒ *
Utils.capitalize(word) ⇒ String
Capitalize the first letter of a word.
Kind: static method of Utils
Returns: String - The capitalized word.
| Param | Type | Description | | --- | --- | --- | | word | String | The word to capitalize. |
Utils.getRandomFromArray(arr) ⇒ *
Get a random element from the array
Kind: static method of Utils
Returns: * - The random element chosen.
| Param | Type | Description | | --- | --- | --- | | arr | Array | The array to get a random element from. |