Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/trescenzi/sylla-api

A random name generator
https://github.com/trescenzi/sylla-api

Last synced: about 1 month ago
JSON representation

A random name generator

Awesome Lists containing this project

README

        

# Sylla API

Sylla is a simple syllable based random name generator which can generate names with two different modes and given any seed. A default seed of 7000 English names is used if other seeds are not provided.

## Modes

- Random: Names are generated by taking the seed names, splitting them into syllables, and mixing them up. A small number of rules are used to avoid utterly unpronounceable names, however these names can end up looking rather weird.
- Markov: Names are generated by using a Markov Chain based on splitting the source names by character. The resulting names are bounded by syllable lengths and must be rather different from any given source name. As a result some iterations will fail to generate names.

## API

The name generation is accessible via a simple api. The api is currently hosted on my home server.

### /names

Returns a variable number of names.

Allowed Methods: POST, GET

Params are as follows:
- numNames : number
The number of names to generate
- numSyllablesPerName : number
The number of syllables per name to use when generating the names
- nameSeeds : str | list
A list of names to use as seeds for generating the new name. If
provided as a string it can be space or comma seperated.

GET requests should provide them as query params, POST as a json body.

#### Example

`curl -H "Content-Type: application/json" -X POST -d '{"numSyllablesPerName": 4, "numNames": 10}' sylla.tcrez.dev/names`

### /name

Returns a single name.

Allowed Methods: POST, GET

Params are as follows:
- numSyllables : number
The number of syllables to include in the name
- nameSeeds : str | list
A list of names to use as seeds for generating the new name. If
provided as a string it can be space or comma seperated.

GET requests should provide them as query params, POST as a json body.

#### Example

`curl -H "Content-Type: application/json" -X POST -d '{"numSyllables: 10}' sylla.tcrez.dev/name`

### /markov/names

Returns a variable number of names generated using a Markov chain based
on the seed.

Allowed Methods: POST, GET

Params are as follows:
- numNames : number
The number of names to generate.
NOTE: You are not guarenteed to get this number of names back. In order
to prevent excessive computation only 15 attempts are made per name
to generate a name that fits within the parameters of the markov
chain for likeness. In practice with the default seed names ~1% of
attempts fail with a 2 syllable min and a 4 syllable max.
- maxSyllablesPerName : number
The maximum number of syllables to include in the generated names.
Default 4
- minSyllablesPerName : number
The minimum number of syllables to include in the generated names.
Default 2
- nameSeeds : str | list
A list of names to use as seeds for generating the new name. If
provided as a string it can be space or comma seperated.

GET requests should provide them as query params, POST as a json body.

Response - JSON with keys:
- names : array
The names generated
- namesGenerated : number
The number of names generated

#### Example

`curl -H "Content-Type: application/json" -X POST -d '{"minSyllablesPerName": 1, "maxSyllablesPerName": 3, "numNames": 20}' sylla.tcrez.dev/markov/names`