定制 aheenam/similar-string 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

aheenam/similar-string

Composer 安装命令:

composer require aheenam/similar-string

包简介

Find level of similarity between strings based on Dice's Coefficient

README 文档

README

Find level of similarity between strings based on Dice's Coefficient.

Installation

Install the package by running

$ composer require aheenam/similar-string

Usage

This package contains two classes, one for calculating Dice's Coefficient of two strings and another working with this value.

Dice's Coefficient

<?php

use Aheenam\SimilarString\Dice;

(new Dice)('night', 'nacht') // returns 0.25
(new Dice)('abcd', 'abcd') // returns 1
(new Dice)('qwerty', 'asdf') // returns 0

Similar Strings

This class provides 2 different methods:

orderBySimilarity($string, $similarStrings = [])

This method orders the strings in $similarStrings by their Dice-Coefficient when compared to $string

<?php

use Aheenam\SimilarString\SimilarString;

(new SimilarString)->orderBySimilarity('nacht', ['night', 'abcde', 'lacht']);
// returns ['lacht', 'night', 'abcde']

findMostSimilar($string, $similarStrings = [])

This methods returns the best match for $string out of $similarStrings

<?php

use Aheenam\SimilarString\SimilarString;

(new SimilarString)->findMostSimilar('nacht', ['night', 'abcde', 'lacht']);
// returns 'lacht'

Changelog

Check CHANGELOG for the changelog

Testing

To run tests use

$ composer test

If you are working on a windows machine use

vendor\bin\phpunit

Contributing

Information will follow soon

Security

If you discover any security related issues, please email rathes@aheenam.com or use the issue tracker of GitHub.

About

Aheenam is a small company from NRW, Germany creating custom digital solutions. Visit our website to find out more about us.

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 1.5k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-01-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固