jity/tag-generator
Composer 安装命令:
composer require jity/tag-generator
包简介
Generate Tags from a given text.
关键字:
README 文档
README
About
This bundle is part of the Jity project. With the help of this generator you be able to transform any text to a usefull collection of tags.
Installation
Add JityTagGenerator to your composer.json:
{
"require": {
"jity/tag-generator": "dev-master"
}
}
Download bundle:
php composer.phar update
Add the JityTagGenerator to your AppKernel.php
public function registerBundles()
{
$bundles = array(
...
new Jity\TagGeneratorBundle\JityTagGeneratorBundle(),
...
);
...
}
Usage
This is a simple example how to use the TagGenerator.
use Jity\Tag\TagGenerator,
Jity\Tag\Filter\Score,
Jity\Tag\Filter\ScoreGroup,
Jity\Tag\Filter\Length,
Jity\Tag\Filter\Occurrence,
Jity\Tag\Filter\Dictionary,
Jity\Tag\Filter\Capitalized,
Jity\Tag\Filter\Uppercase,
Jity\Tag\Filter\Camelcase,
Jity\Tag\Filter\Regex;
/* ------------------------------------------------------ */
/* - Configuration */
/* ------------------------------------------------------ */
// Instantiate a new Generator
$generator = new TagGenerator();
// Configure all Filters
$generator
/* Remove words shorter than 3 chars */
->addFilter(
new Length(1, true, array(
'min' => 2
))
)
/* Remove most useless words from collection (stop-words) */
->addFilter(
new Dictionary(1, true, array(
'match' => true,
'casesensitive' => false,
'dictionaries' => array(
'german' => array(
'adjektive',
'verben',
'klein',
'fixwords'
)
)
))
)
/* Score occurrence of remaining words */
->addFilter(
new Occurrence(5)
)
/* Score uppercased words */
->addFilter(new Uppercase(15))
/* Score camelcased words */
->addFilter(new Camelcase(15))
/* Score capitalized words */
->addFilter(new Capitalized(5));
// Receive the collection of tags
$tags = $generator->getTags('Lorem ipsum etc');
Development
Write own filters
All you need to do this is to implement Jity\Tag\Filter\FilterInterface or extend Jity\Tag\Filter\AbstractFilter. A good and simple example is the Jity\Tag\Filter\Uppercase filter. Just have a look at this.
Recompile a dictionary
Go to resources/dictionaries/LANG/source and run:
for i in stopwords fixwords adjektive verben compound klein verben worte; do cat source/${i}*.txt | ../compiler.sh "$i"; done
jity/tag-generator 适用场景与选型建议
jity/tag-generator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11 次下载、GitHub Stars 达 0, 最近一次更新时间为 2012 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「generator」 「tags」 「analyser」 「jity」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jity/tag-generator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jity/tag-generator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jity/tag-generator 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Fast detection of composer dependency issues (dead dependencies, shadow dependencies, misplaced dependencies)
PHP performance tool analyser your script on time, memory usage and db query. Support Laravel and Composer for web, web console and command line interfaces.
Memio's PrettyPrinter, used to generate PHP code from given Model
A powerfull cacher based on laravels file cache driver
Phalcon PHP Meta tags service
A tool for scraping URL resources (oEmbed, OpenGraph, Twitter cards, JSON-LD)
统计信息
- 总下载量: 11
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2012-11-10