0.2.0 • Published 6 years ago
cheap-dream v0.2.0
cheap-dream
generate images, text or audio with a Markov chain
Installation
$ npm install cheap-dream
API
parseText(text) ⇒ Object
Parses a string to a model that can be used to generate a new text.
Kind: global function Returns: Object - The model to be used with generateText
Param | Type | Description |
---|---|---|
text | string | The text to parse |
generateText(model, options) ⇒ string
Generates a new text from the model
Kind: global function Returns: string - The new text
Param | Type | Default | Description |
---|---|---|---|
model | Object | The model generated with parseText | |
options | Object | Configuration options | |
options.maxTries | number | 100 | The maximum amount of attempts |
options.startWith | string | The string to start with, random by default | |
options.endWith | function | Function that will be called with the current word, return true to end |
parseImage(image) ⇒ Object
Parses an ndarray to a model that can be used to generate a new image.
Kind: global function Returns: Object - The model to be used with generateImage
Param | Type | Description |
---|---|---|
image | ndarray | The image to parse |
generateImage(model, options) ⇒ ndarray
Generates a new image from the model
Kind: global function Returns: ndarray - The new image
Param | Type | Description |
---|---|---|
model | Object | The model generated with parseImage |
options | Object | Configuration options |
options.width | number | The width of the output image |
options.height | number | The width of the output image |
options.startWith | Array | The color to start with, array with red, green, blue |
options.endWith | function | Function that will be called with the current color, return true to end |