Giter Site home page Giter Site logo

boyer-moore's Introduction

PHP实现的Boyer-Moore字符搜索算法,支持中文。 PHP implementation of Boyer-Moore character search algorithm, support for Chinese.

GitHub repo size GitHub Last Tag GitHub last commit GitHub All Releases

GitHub stars GitHub forks

Requirement

"symfony/polyfill-mbstring": "^1.23"

Install

composer require anhoder/boyer-moore

Usage

require './vendor/autoload.php';

$text = 'ababa';
$matcher = new \Anhoder\Matcher\BoyerMooreMatcher('aba');
$res = $matcher->match($text, \Anhoder\Matcher\BoyerMooreMatcher::MODE_REUSE_MATCHED);
var_dump($res);
  • BoyerMooreMatcher::MODE_ONLY_ONE: 匹配到一个就返回
  • BoyerMooreMatcher::MODE_SKIP_MATCHED: 找出所有匹配的字串,已匹配的字符不参与后续匹配,例如:在ababa中搜索aba结果为[0]
  • BoyerMooreMatcher::MODE_SKIP_MATCHED: 找出所有匹配的字串,已匹配字符继续参与匹配,例如:在ababa中搜索aba结果为[0, 2]

boyer-moore's People

Contributors

anhoderai avatar anhoder avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.