john-kariuki / urban-words
城市词汇,CheckpointOne Andela
Requires
- php: >=5.6
Requires (Dev)
- phpunit/phpunit: ^5.1
- scrutinizer/ocular: ~1.1
- squizlabs/php_codesniffer: ~2.3
This package is not auto-updated.
Last update: 2024-09-24 22:02:24 UTC
README
![构建通过] (https://travis-ci.org/andela-jkariuki/CheckpointOne.svg?branch=master)
Urban Dictionary Agnostic PHP Package
Andela Checkpoint One.
城市词汇管理器
城市词汇字典,城市词汇 CRUD 和句子中词汇出现的排名系统。
词汇排名管理器
对句子中词汇的出现进行排名。
#TIA
安装
将包添加到项目文件夹中
composer require john-kariuki/urban-words
使用 Composer 安装包
composer install
使用方法
让我们开始使用 Urban Words
<?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(); }
贡献
贡献是 欢迎 的,并且将得到完全 认可。
我们通过 Github 上的拉取请求接受贡献。
拉取请求
-
PSR-2 编码标准 - 应用约定最简单的方法是安装 PHP Code Sniffer。
-
添加测试! - 如果你的补丁没有测试,它将不会通过。
-
记录任何行为变更 - 确保代码库的
README.md
和任何其他相关文档保持最新。 -
考虑我们的发布周期 - 我们试图遵循 SemVer v2.0.0。随机破坏公共 API 不是选择。
-
创建功能分支 - 不要要求我们从你的 master 分支拉取。
-
每个功能一个拉取请求 - 如果你想做更多的事情,请发送多个拉取请求。
-
发送连贯的历史 - 确保你的拉取请求中的每个单独提交都有意义。如果你在开发过程中不得不做出多个中间提交,请在提交之前请 压缩它们。
安全
如果你发现任何与安全相关的问题,请通过电子邮件联系我 John Kariuki 或创建一个问题。
鸣谢
许可证
MIT 许可证 (MIT)
版权 (c) 2016 John kariuki john.kariuki@andela.com
这是开源软件,根据 MIT 许可证 许可。