2017 © Pedro Peláez
 

library urban-words

Urban words, CheckpointOne Andela

image

john-kariuki/urban-words

Urban words, CheckpointOne Andela

  • Tuesday, April 12, 2016
  • by andela-jkariuki
  • Repository
  • 1 Watchers
  • 2 Stars
  • 14 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

CheckpointOne

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

Urban Dictionary Agnostic PHP Package

Andela Checkpoint One., (*2)

Urban Words Manager

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

Word Rank Manager

Rank the occurence of words in a sentence., (*4)

#TIA, (*5)

Installation

add the package to your projects folder, (*6)

composer require john-kariuki/urban-words

Install packages using composer, (*7)

composer install

Usage

Let's get using Urban Words, (*8)

<?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., (*9)

We accept contributions via Pull Requests on Github., (*10)

Pull Requests

  • PSR-2 Coding Standard - The easiest way to apply the conventions is to install PHP Code Sniffer., (*11)

  • Add tests! - Your patch won't be accepted if it doesn't have tests., (*12)

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

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

  • Create feature branches - Don't ask us to pull from your master branch., (*15)

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

  • 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., (*17)

Security

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

Credits

John kariuki, (*19)

License

The MIT License (MIT)

Copyright (c) 2016 John kariuki john.kariuki@andela.com, (*20)

This is open-sourced software licensed under the MIT license., (*21)

The Versions

12/04 2016

dev-master

9999999-dev https://github.com/andela-jkariuki/CheckpointOne

Urban words, CheckpointOne Andela

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by :John Kariuki

john-kariuki urban-words

24/01 2016

1.0.0

1.0.0.0 https://github.com/andela-jkariuki/CheckpointOne

Urban words, CheckpointOne Andela

  Sources   Download

MIT

The Requires

  • php >=5.6

 

The Development Requires

by :John Kariuki

john-kariuki urban-words