Urban Dictionary
The Dictionary is a PHP agnostic package
that returns meaning of slangs and
sample usage of the slang., (*1)
Design
Classes
- Data: The Data Class that houses the dictionary array
- Dictionary: This is the Class that houses the five core
methods of the application which are as follows
-addWord($word);
-updateWord($word);
-findWord($word);
-removeWord($word);
-rankWords($sentence), (*2)
Testing
The framework for testing this application is
phpunit and the TDD principle was used to
make sure that the code was well tested., (*3)
```````
php vendor/phpunit/phpunit/phpunit
`````````, (*4)
Install
- To install this package from packagelist, PHP 5.0+ and Composer are required
````
composer require andela/dictionary
``````, (*5)
Install
The sample codes below shows how to use this package, (*6)
-
To instantiate the Dictionary Class, (*7)
$dictionary = new \Andela\Dictionary\Dictionary();
-
To add the slang "park", it's meaning "Tell someone to relax", and sample usage "Guy park well o", (*8)
$dictionary->addWord('park', 'Tell someone to relax', 'Guy park well o')
-
To update the slang "park", (*9)
$dictionary->updateWord('park', 'A car park', 'An updated Test');
-
To find the slang "park", (*10)
$dictionary->findWord('park');
-
To remove the slang "park", (*11)
$dictionary->removeWord('park');
-
To test for word ranking, (*12)
$word = new \Andela\Dictionary\Dictionary();
$word->rankWords("Hello it is nice to tell if it is cool to say rubbish");
Change log
Please refer to CHANGELOG file for information on what has changed recently., (*13)
Contributing
Please check out CONTRIBUTING file for detailed contribution guidelines., (*14)
Credits
Andela urban Dictionary is maintained by Chidozie Ijeomah., (*15)
License
Andela urban Dictionary is released under the MIT Licence. See the bundled LICENSE file for details., (*16)