GithubHelp home page GithubHelp logo

rhymetime's Introduction

Introduction

{REMOVED}

Assignment

{REMOVED}

Description

This tool implements a restful JSON API at /api/v1.0/words/ with three routes:

POST randomchoice

The randomchoice route accepts a JSON object containg a words key with a value of a list containing two or more elements. The route returns a JSON object with a key of 1word and a value of one of the submitted elements selected at random.

This route opts for the use of POST over GET in order to be able to more reliably support lengthy submissions

GET pronunciations

The pronunciations route accepts a query with a word argument of one english word and returns a json object containing a pronunciations and a word key. The pronunciations key contains a list of the known possible pronunciations of that word using ARPAbet1 notation. word contains the queried word.

Words are considered english only if they appear in the CMU Pronouncing Dictionary.

GET rhymes

The rhymes route accepts a query with a word argument of one english word and optionally a pronunciation_id route corresponding to the index of the pronunciation returned from GET pronunciations. The route returns a JSON object with a rhymes and word key. The word key always contains the queried word. If no optional parameter is provided by the client, the rhymes key will contain a list of all rhymes detected in the CMU pronouncing dictionary for all known pronunciations of the queried word or, in the event that no rhymes are found in dictionary, an empty list. If a valid pronunciation index id if provided, the rhymes key will contain a list of only those words that rhyme with the particular pronunciation.

GET pronunciations and GET rhymes are intended to be used together to provide a more advanced search feature than GET rhymes alone.

Dependencies/Environment

  • Python 3.5
  • pip 9.0.1
  • wheel*
  • venv 3.5*

*: Not required but recommended

Basic Install (Debian/Ubuntu/Mint Linux)

  1. Install python 3.5

  2. Unpack/Clone this repo

  3. Open a Terminal in the root directory of this project

  4. (Optionally) Create a virtual environment (venv) and activate it by running:

    $ source ./venv/bin/activate

  5. Install pip and wheel (if not already installed)

  6. Install dependencies listed in requirements.txt by executing:

    $ pip install -r ./requirements.txt

  7. Set the Flask environment variable:

    $ export FLASK_APP=rhymetime

  8. Execute:

    $ flask run

Alternatively, you may use the included dockerfile to create a docker image/container.

Tests

Tests have been created for this project and are located in the /tests directory. in order to run the tests execute pytest or, for more details pytest -v.

Footnotes

  1. https://en.wikipedia.org/wiki/ARPABET โ†ฉ

rhymetime's People

Contributors

jdbean avatar

Watchers

James Cloos avatar  avatar

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.