2017 © Pedro PelĂĄez
 

library dictionary

An urban dictionary agnostic of common slangs and their meanings

image

florence/dictionary

An urban dictionary agnostic of common slangs and their meanings

  • Wednesday, December 27, 2017
  • by florenxe
  • Repository
  • 1 Watchers
  • 2 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Build Status, (*1)

Checkpoint One

This package was built mainly for academic purposes. It can be described ad an agnostic package that conforms with thephpleague.com specifications and uses the Test Driven Development process (PHPUnit), (*2)

Classes

  • Data: The main dictionary, a static associative array that contains urban words, (*3)

  • Dictionary: CRUD implementations and Ranking System Implementation., (*4)

  • WordExistsException: Returns the associated exception message, (*5)

  • WordNotFoundException: Returns the associated exception message, (*6)

Installation

Require via composer like so:, (*7)

    composer require florence/dictionary

Usage

    $dictionary = Data::$data;

    $dictionary = new Dictionary($dictionary); 

Add Slang

    $dictionary->addSlang($slang, $description, $sentence);

Retrieve Slang

    $dictionary->findOne($slang);

    $dictionary->findAll();

Update Slang

    $dictionary->updateSlang($slang, $description, $sentence);

Delete Slang

    $dictionary->deleteOne($slang);

    $dictionary->deleteAll();

Implement Ranking

The ranking system is implemented using the rankWords() method., (*8)

You can now traverse through the Data array to get your desired output like so:, (*9)

foreach(Data::$data as $row => $innerArray)
{   

    $res = $innerArray['Sample-sentence'];

    $getRank = $ranker->rankAndSort($res);

    $output = '';

        foreach($getRank as $key => $value)
        {
            $output .= "$key => $value".', ';
        }

        $output = rtrim("[".$output,','."]")."<br>";

        // print the final output

        echo $output;
        echo "<br>";
}

Sample Output:, (*10)

[“Tight” => 3, “Prosper” => 2, “Yes” => 1, “Have” => 1, “you” => 1, “finished” => 1, “the” => 1, “curriculum?” => 1]

The Versions

27/12 2017

dev-master

9999999-dev

An urban dictionary agnostic of common slangs and their meanings

  Sources   Download

MIT

The Requires

 

by andela-fokosun