GithubHelp home page GithubHelp logo

carlgieringer / animal-phrases Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 1.0 9 KB

A python tool for creating animal-based rhymes and alliterations

License: MIT License

Python 96.19% Shell 3.81%
rhymes animals nlp pronounciation alliteration

animal-phrases's Introduction

Animal Phrase Generator

Several years ago, some friends stood around looking at each other awkwardly at the end of standup, uncertain if we were done or not. One team member said, "awesome possum". Thus begun a daily ritual of ending our standup with an animal phrase to confirm that standup was over with a laugh. This library is an exploration in automatically generating rhyming or alliterative phrases based on animals.

Animal Phrase Rules

  1. The phrase must be of the form <adjective> <animal>
  2. The phrase must contain some literary device such as a rhyme or an alliteration.
  3. The adjective should have a positive connotation (we want to start the day on the right foot, after all!)

Examples

"rococo buffalo", "profuse moose", "astute newt", and "plausible platypus"

Running

# requires python 3.6
pip install -r requirements.txt
bin/get-nrc-emotions.sh
PYTHONPATH=. python animal_phrases/main.py -h
PYTHONPATH=. python animal_phrases/main.py --no-negative --alliterations

How it works

The scripts works roughly by:

  1. Compile a list of animals (currently it scrapes https://a-z-animals.com/animals/)
  2. Compile a list of adjectives by filtering the Brown corpus to words having part-of-speech of ADJ
  3. For each animal, find its adjective rhymes and alliterations using the pronouncing library.
    1. For rhymes, return the intersection of adjectives with the rhymes found by searching for the rhyming_part.
    2. For alliterations, return the intersection of adjectives with the words sharing the first --alliteration-phone-count phones.
  4. If --no-negative is present, filter the adjectives to exclude those with negative connotations, as reported by the NRC Emotion Lexicon

Ideas for Further Improvements

  • Enhance alliteration to work similarly to pronouncing's rhyming: both words must match sounds up until the first vowel sound (e.g. "axial Akbash")
  • Alliterations tend to be pretty common, and the same adjective will appear with multiple animals sharing the first initial phone. Try ranking alliterations by the number of common initial phones and then output the best ones.
  • finish manually labeling custom-sentiments.txt to increase sentiment precision
  • log animals lacking pronunciations in the CMU library; manually provide pronunciations.
  • create a model for inferring pronunciation of animals

animal-phrases's People

Contributors

carlgieringer avatar

Watchers

 avatar  avatar  avatar

Forkers

xwang-saj

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.