opeyemiabiodun/urban-dictionary

创建你的俚语词典。

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

This package is not auto-updated.

Last update: 2024-09-14 18:36:23 UTC


README

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

检查点 1/a; Urban-Dictionary Agnostic PHP Package

该包允许非持久化存储数据。具体来说;俚语、它们的含义以及使用这些俚语的句子示例。通过此包还可以创建、读取、更新和删除这些俚语的记录。最后,该包还可以根据这些词在句子中的出现次数对这些词进行排名。该包采用了PSR-2编码标准,同时也采用了PSR-4自动加载约定。

安装

通过Composer

$ composer require opeyemiabiodun/urban-dictionary

用法

<?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];
    */
?>

变更日志

请参阅CHANGELOG了解最近的变化。

测试

$ composer test

贡献

请参阅CONTRIBUTINGCONDUCT以获取详细信息。

安全

如果您发现任何与安全相关的问题,请通过电子邮件opeyemi.ogunjimi@andela.com联系,而不是使用问题跟踪器。

鸣谢

许可证

MIT许可证(MIT)。有关更多信息,请参阅许可证文件