Giter Club home page Giter Club logo

checkpointone's Introduction

CheckpointOne

![Build Pass] (https://travis-ci.org/andela-jkariuki/CheckpointOne.svg?branch=master) Scrutinizer Code Quality Coverage Status

Urban Dictionary Agnostic PHP Package

Andela Checkpoint One.

Urban Words Manager

An urban words dictionary, Urban Word CRUD and Ranking System for word occurence in a sentence.

Word Rank Manager

Rank the occurence of words in a sentence.

#TIA

Installation

add the package to your projects folder

composer require john-kariuki/urban-words

Install packages using composer

composer install

Usage

Let's get using Urban Words

<?php
require 'vendor/autoload.php';

use John\Cp\UrbanWordsDatastore;
use John\Cp\UrbanWordsManager;
use John\Cp\WordRankManager;
use John\Exceptions\UrbanWordException;
use John\Exceptions\WordRankManagerException;
use John\Exceptions\WordManagerException;

//Class UrbanWordsDatastore contains a static array of urban words
print_r(UrbanWordsDatastore::$data);

/**
    * Class UrbanWordsManager performs CRUD methods on the $data array in UrbanWordsDataStore
    * Methods:
    * addWord(word, desc, sentence)
    * readWord(word)
    * updateWord(word, foo, bar, foobar)
    * deleteWord(word)
*/
try {

    $urbanWord = new UrbanWordsManager();

    //Add new word, description and sentence
    print_r($urbanWord->addWord('Bae', 'Endearing term for lover', 'Your bae has a bae'));

    //Pass slang word to read
    print_r($urbanWord->readWord('Bae'));

    //Update slang word details
    print_r($urbanWord->updateWord("Bae", "Foo", "Bar", "Foo Bar"));

    //Pass slang word to delete
    print_r($urbanWord->deleteWord('Turnt'));

    print_r($urbanWord->getWords());

} catch (WordManagerException $e) {
    echo $e->errorMessage();
}

//Class WordRankManager returns the frequency of occurence of a word in a sentence


try {
    $sentence = new WordRankManager("The big brown fox is just a big brown fox jumping up all in the lazy dog's business");
    print_r($sentence->ranker());
} catch (WordRankManagerException $e) {
    echo $e->errorMessage();
}

Contributing

Contributions are welcome and will be fully credited.

We accept contributions via Pull Requests on Github.

Pull Requests

  • PSR-2 Coding Standard - The easiest way to apply the conventions is to install PHP Code Sniffer.

  • Add tests! - Your patch won't be accepted if it doesn't have tests.

  • Document any change in behaviour - Make sure the README.md and any other relevant documentation are kept up-to-date.

  • Consider our release cycle - We try to follow SemVer v2.0.0. Randomly breaking public APIs is not an option.

  • Create feature branches - Don't ask us to pull from your master branch.

  • One pull request per feature - If you want to do more than one thing, send multiple pull requests.

  • Send coherent history - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting.

Security

If you discover any security related issues, please email me at John Kariuki or create an issue.

Credits

John kariuki

License

The MIT License (MIT)

Copyright (c) 2016 John kariuki [email protected]

This is open-sourced software licensed under the MIT license.

checkpointone's People

Watchers

 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.