mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-03-08 15:02:05 +08:00
0.0.1
This commit is contained in:
96
docs/php/similar_text.html
Normal file
96
docs/php/similar_text.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
|
||||
<title>计算两个字符串的相似度</title>
|
||||
</head>
|
||||
<body class="docs"><div id="layout">
|
||||
<div id="layout-content"><div id="function.similar-text" class="refentry">
|
||||
<div class="refnamediv">
|
||||
<h1 class="refname">similar_text</h1>
|
||||
<p class="verinfo">(PHP 4, PHP 5, PHP 7)</p><p class="refpurpose"><span class="refname">similar_text</span> — <span class="dc-title">计算两个字符串的相似度</span></p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="refsect1 description" id="refsect1-function.similar-text-description">
|
||||
<h3 class="title">说明</h3>
|
||||
<div class="methodsynopsis dc-description">
|
||||
<span class="methodname"><strong>similar_text</strong></span>
|
||||
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$first</code></span>
|
||||
, <span class="methodparam"><span class="type">string</span> <code class="parameter">$second</code></span>
|
||||
[, <span class="methodparam"><span class="type">float</span> <code class="parameter reference">&$percent</code></span>
|
||||
] ) : <span class="type">int</span></div>
|
||||
|
||||
<p class="para rdfs-comment">
|
||||
两个字符串的相似程度计算依据 Programming Classics: Implementing the World's Best Algorithms by Oliver (ISBN 0-131-00413-1) 的描述进行。注意该实现没有使用 Oliver 虚拟码中的堆栈,但是却进行了递归调用,这个做法可能会导致整个过程变慢或变快。也请注意,该算法的复杂度是 O(N**3),N 是最长字符串的长度。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="refsect1 parameters" id="refsect1-function.similar-text-parameters">
|
||||
<h3 class="title">参数</h3>
|
||||
<p class="para">
|
||||
<dl>
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">first</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
第一个字符串。
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">second</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
第二个字符串。
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
||||
<dt>
|
||||
<code class="parameter">percent</code></dt>
|
||||
|
||||
<dd>
|
||||
|
||||
<p class="para">
|
||||
通过引用方式传递第三个参数,<span class="function"><strong>similar_text()</strong></span> 将计算相似程度百分数。
|
||||
</p>
|
||||
</dd>
|
||||
|
||||
|
||||
</dl>
|
||||
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="refsect1 returnvalues" id="refsect1-function.similar-text-returnvalues">
|
||||
<h3 class="title">返回值</h3>
|
||||
<p class="para">
|
||||
返回在两个字符串中匹配字符的数目。
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="refsect1 seealso" id="refsect1-function.similar-text-seealso">
|
||||
<h3 class="title">参见</h3>
|
||||
<p class="para">
|
||||
<ul class="simplelist">
|
||||
<li class="member"><span class="function"><a href="levenshtein.html" class="function" rel="rdfs-seeAlso">levenshtein()</a> - 计算两个字符串之间的编辑距离</span></li>
|
||||
<li class="member"><span class="function"><a href="soundex.html" class="function" rel="rdfs-seeAlso">soundex()</a> - Calculate the soundex key of a string</span></li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
</div></div></div></body></html>
|
||||
Reference in New Issue
Block a user