opeyemiabiodun/urban-dictionary

Make your dictionary of slangs.

dev-master 2015-11-22 05:28 UTC

This package is not auto-updated.

Last update: 2024-12-21 20:41:23 UTC


README

Latest Version on Packagist Software License Build Status Code Coverage Scrutinizer Code Quality

CheckPoint 1/a; Urban-Dictionary Agnostic PHP Package

The package enables the non-persistent storage of data. Specifically; slangs, their meanings and examples of sentences where they are used. Creating, reading, updating and deleting records of these slangs are also made possible by this package. Finally, the package can also rank words within sentences by the number of occurences of these words within the sentences. PSR-2 coding standard was adopted in writing the package. The PSR-4 autoloading convention was also adopted.

Install

Via Composer

$ composer require opeyemiabiodun/urban-dictionary

Usage

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

    use Opeyemiabiodun/UrbanDictionary/Dictionary;
    use Opeyemiabiodun/UrbanDictionary/Rank;

    /*
     The following methods below perform CRUD operations in the dictionary.
     The arguments passed into the methods are strings.
    */
    Dictionary::getInstance()->add($slang, $description, $sampleSentence);
    Dictionary::getInstance()->read($slang);
    Dictionary::getInstance()->select($slang);
    Dictionary::getInstance()->update($slang, $description, $sampleSentence);
    Dictionary::getInstance()->delete($slang);
    Dictionary::getInstance()->getAll();
    Dictionary::getInstance()->clear();

    /*
      To update a slang in the dictionary.First select it before passing in updated values.
     */
    Dictionary::getInstance()->select($slang);
    Dictionary::getInstance()->update($slang, $description, $sampleSentence);

    $_sentences = “Andrei: Prosper, Have you finished the curriculum?.
                  Prosper: Yes.
                  Andrei: Tight, Tight, Tight!!!”

    $wordsRank = Rank::getInstance()->execute($_sentences);
    /*
     $wordsRank = [“Tight” => 3, “Prosper” => 2, “Yes” => 1, “Have” => 1, “you” => 1,
                    “finished” => 1, “the” => 1, “curriculum?” => 1];
    */
?>

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email opeyemi.ogunjimi@andela.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.