Skip to content

Generate random sayings from pieces of existing idioms and aphorisms.

License

Notifications You must be signed in to change notification settings

davidsteinberg/sayings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

As they say

As they say is a random saying generator that combines parts of existing sayings, producing sometimes insightful and hilarious outcomes. It works by breaking existing sayings into connections between their words' parts of speech and texts and then randomly combining them.

Input

The sayings are from the following sources, all released under a Creative Commons Attribution-ShareAlike License 3.0:

Because the word lists are mostly from contented generated by users, you may encounter material that you find offensive or otherwise objectionable. Please use common sense and proper judgment when using the project's data.

Implementation

Using the natural language processing library, compromise, each saying is parsed into a grammatical template, with its words' parts of speech and texts stored as a series of connections in a lookup table.

To generate a new saying, a random grammatical template is chosen. For each part of speech in the template, a random word is looked up using the previous word's part of speech and text.

Take, for example, the saying "a dog is a man's best friend." Compromise tags it as follows:

  • a → Determiner
  • dog → Singular, Noun
  • is → Verb, Copula, PresentTense
  • a → Determiner
  • man's → Noun, Singular, Possessive
  • best → Adjective
  • friend → Noun, Singular

When this saying's grammatical template is chosen for a new saying, it begins by looking up all determiners that start a saying and randomly chosing one of them.

Let's say the determiner "the" is chosen. The next step is to look up all singular nouns that follow the word "the" used as a determiner.

Let's say the singular noun "place" is chosen. The next step is to look up all present tense verbs that follow the word "place" used as a singular noun (as opposed to a verb, for example).

This process repeats until each part of speech in the template has been filled.

Finally, the app checks to make sure the generated saying isn't an exact match with any actual saying.

Development

The app is built with React, using Create React App to set up the project. Prettier is used to format the code.

License

The software in this project is released under an MIT license.

The sayings in this project are released under a Creative Commons Attribution-ShareAlike 4.0 International License.

About

Generate random sayings from pieces of existing idioms and aphorisms.

Resources

License

Stars

Watchers

Forks