承接 dansrocks/text-search-helper 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dansrocks/text-search-helper

Composer 安装命令:

composer require dansrocks/text-search-helper

包简介

A search tool to search a list of needles into a spread text.

README 文档

README

A search tool to search a list of needles into a spread text.

    "php": "^7.2",

Available Classes

Interface: TextSearchInterface

Interface for TextSearch class

Methods:

  • Construct: Require a text to search in.

  • __construct(string $text, ?int $min_length = null, ?float $max_freq = null);
    
  • Returns true if the $needle is found into text

  • search(Needle $needle) : bool;
    
  • Get original text (dummy method)

  • getText(): string;
    

Class: TextSearch

Main class

Class: Needle

A wrapper class around a needle (string) to search into a text.

#How to install

composer require dansrocks/text-search-helper

#How to use

<?php

namespace YOUR-NAMESPACE;

use Helpers\SearchTools\TextSearch;

[...]
 
$text = "Lorem ipsum dolor sit amet, consectetur adipiscing
         elit. Ut facilisis nunc ac rutrum egestas. Pellentesque
         sodales gravida risus in blandit. Nulla facilisi.
         Aenean hendrerit augue arcu, ut sodales lacus elementum
         in. Fusce dolor dui, tempus eget neque in, tincidunt
         pharetra sem. Donec semper ante vel nisi rhoncus, nec
         auctor dolor ornare.";

$searcher = new TextSearch($text);

$needle = new Needle("fusce dolor dui tempus");

if ($searcher->search($needle)) {
    echo "Found it!";
} else {
    echo "Sorry, I can not be able to find it."; 
}

#Avanced search

Text search has 2 extra parameters in order to remove any usual words and/or words lower than a length.

You can enable these functionalities in __construct();

ex1. __construct($text, 3);           // remove words with <3 characters
ex2. __construct($text, null, 0.3);   // remove words with 30% of frequency 

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2020-04-19

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固