Since I am a senior in high school, I have no time to maintain it before the college entrance examination this year. Please forgive me.
Noise Sentence is a random combination system of multiple natural language sentence components. To put it simply, it is a random sentence creation .
It's not on npm yet, but it will be there then.
The noise API is contained in a unique namespace object zaoju
.
(preferably at the end of the document) include zaoju .js
and then just create on the page:
onclick
of a specific button calls the specific API function in zaoju .js
, and handles appropriate exceptions;A token is a piece of text that has one or more tags. like:
A word element is a concept. When implemented in code, a word element may not be mapped by an object.
The thesaurus is unique and contains several tag arrays. The elements in each tag array are the textual content (string) of the word element with the tag. like:
> dict["person"] < (3) ["Laowang", "head teacher", "you"] > dict["can-fly"]; < (5) ["plane", "swan", "pig" ", "Mood", "Dust"] > dict["brilliant"]; < (Infinity) ["I", "I", "I", ...]
The last two sentences are a joke~
The generation rule is an array whose elements represent the rules for randomly generated text in order. Its elements are objects containing at least type
and value
attributes:
type
, only two possible values: "text"
or "tag"
.value
, when a non-empty string generates text, the generation function will check the generation rules in sequence. If type
is "text"
, value
will be output directly; if it is "tag"
, a randomly selected one will be selected from the corresponding tag array in the vocabulary. Word output. MIT License Copyright © 2014-2018 Tan Shihuai