blob: e115fbf6ebb3f40604805c70a625c4f8948962d1 [file] [log] [blame]
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Namespace Lucene.Net.Search.Spell
| Apache Lucene.NET 4.8.0-beta00010 Documentation </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Namespace Lucene.Net.Search.Spell
| Apache Lucene.NET 4.8.0-beta00010 Documentation ">
<meta name="generator" content="docfx 2.56.0.0">
<link rel="shortcut icon" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/favicon.ico">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.css">
<link rel="stylesheet" href="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.css">
<meta property="docfx:navrel" content="toc.html">
<meta property="docfx:tocrel" content="suggest/toc.html">
<meta property="docfx:rel" content="https://lucenenet.apache.org/docs/4.8.0-beta00009/">
</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>
<nav id="autocollapse" class="navbar ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img id="logo" class="svg" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/logo/lucene-net-color.png" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>
<div class="subnav navbar navbar-default">
<div class="container hide-when-search">
<ul class="level0 breadcrumb">
<li>
<a href="https://lucenenet.apache.org/docs/4.8.0-beta00009/">API</a>
<span id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</span>
</li>
</ul>
</div>
</div>
</header>
<div class="container body-content">
<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">
<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Lucene.Net.Search.Spell">
<h1 id="Lucene_Net_Search_Spell" data-uid="Lucene.Net.Search.Spell" class="text-break">Namespace Lucene.Net.Search.Spell
</h1>
<div class="markdown level0 summary"><!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<p>Suggest alternate spellings for words.
Also see <a href="http://wiki.apache.org/jakarta-lucene/SpellChecker">the spell checker Wiki page</a>.</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="markdown level0 remarks"></div>
<h3 id="classes">Classes
</h3>
<h4><a class="xref" href="Lucene.Net.Search.Spell.CombineSuggestion.html">CombineSuggestion</a></h4>
<section><p>A suggestion generated by combining one or more original query terms</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.DirectSpellChecker.html">DirectSpellChecker</a></h4>
<section><p>Simple automaton-based spellchecker.
<p>
Candidates are presented directly from the term dictionary, based on
Levenshtein distance. This is an alternative to <a class="xref" href="Lucene.Net.Search.Spell.SpellChecker.html">SpellChecker</a>
if you are using an edit-distance-like metric such as Levenshtein
or <a class="xref" href="Lucene.Net.Search.Spell.JaroWinklerDistance.html">JaroWinklerDistance</a>.
</p>
<p>
A practical benefit of this spellchecker is that it requires no additional
datastructures (neither in RAM nor on disk) to do its work.</p>
<p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.DirectSpellChecker.ScoreTerm.html">DirectSpellChecker.ScoreTerm</a></h4>
<section><p>Holds a spelling correction for internal usage inside <a class="xref" href="Lucene.Net.Search.Spell.DirectSpellChecker.html">DirectSpellChecker</a>.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.HighFrequencyDictionary.html">HighFrequencyDictionary</a></h4>
<section><p>HighFrequencyDictionary: terms taken from the given field
of a Lucene index, which appear in a number of documents
above a given threshold.</p>
<p>Threshold is a value in [0..1] representing the minimum
number of documents (of the total) where a term should appear.</p>
<p>Based on <a class="xref" href="Lucene.Net.Search.Spell.LuceneDictionary.html">LuceneDictionary</a>.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.JaroWinklerDistance.html">JaroWinklerDistance</a></h4>
<section><p>Similarity measure for short strings such as person names.
See <a href="http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance">http://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance</a></p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.LevensteinDistance.html">LevensteinDistance</a></h4>
<section><p>Levenstein edit distance class.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.LuceneDictionary.html">LuceneDictionary</a></h4>
<section><p>Lucene Dictionary: terms taken from the given field
of a Lucene index.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.LuceneLevenshteinDistance.html">LuceneLevenshteinDistance</a></h4>
<section><p>Damerau-Levenshtein (optimal string alignment) implemented in a consistent
way as Lucene&apos;s FuzzyTermsEnum with the transpositions option enabled.</p>
<p>Notes:
<ul><li> This metric treats full unicode codepoints as characters</li><li> This metric scales raw edit distances into a floating point score
based upon the shortest of the two terms</li><li> Transpositions of two adjacent codepoints are treated as primitive
edits.</li><li> Edits are applied in parallel: for example, &quot;ab&quot; and &quot;bca&quot; have
distance 3.</li></ul></p>
<p>NOTE: this class is not particularly efficient. It is only intended
for merging results from multiple DirectSpellCheckers.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.NGramDistance.html">NGramDistance</a></h4>
<section><p>N-Gram version of edit distance based on paper by Grzegorz Kondrak,
&quot;N-gram similarity and distance&quot;. Proceedings of the Twelfth International
Conference on String Processing and Information Retrieval (SPIRE 2005), pp. 115-126,
Buenos Aires, Argentina, November 2005.
<a href="http://www.cs.ualberta.ca/~kondrak/papers/spire05.pdf">http://www.cs.ualberta.ca/~kondrak/papers/spire05.pdf</a></p>
<p>This implementation uses the position-based optimization to compute partial
matches of n-gram sub-strings and adds a null-character prefix of size n-1
so that the first character is contained in the same number of n-grams as
a middle character. Null-character prefix matches are discounted so that
strings with no matching characters will return a distance of 0.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.PlainTextDictionary.html">PlainTextDictionary</a></h4>
<section><p>Dictionary represented by a text file.</p>
<p>Format allowed: 1 word per line:<p>
word1<p>
word2<p>
word3<p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.SpellChecker.html">SpellChecker</a></h4>
<section><p>
Spell Checker class (Main class) <br>
(initially inspired by the David Spencer code).
</p>
<p>Example Usage (C#):
<pre><code> SpellChecker spellchecker = new SpellChecker(spellIndexDirectory);
// To index a field of a user index:
spellchecker.IndexDictionary(new LuceneDictionary(my_lucene_reader, a_field));
// To index a file containing words:
spellchecker.IndexDictionary(new PlainTextDictionary(new FileInfo(&quot;myfile.txt&quot;)));
string[] suggestions = spellchecker.SuggestSimilar(&quot;misspelt&quot;, 5);</code></pre>
</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.SuggestWord.html">SuggestWord</a></h4>
<section><p>SuggestWord, used in suggestSimilar method in <a class="xref" href="Lucene.Net.Search.Spell.SpellChecker.html">SpellChecker</a> class.
<p>
Default sort is first by score, then by frequency.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.SuggestWordFrequencyComparer.html">SuggestWordFrequencyComparer</a></h4>
<section><p>Frequency first, then score.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.SuggestWordQueue.html">SuggestWordQueue</a></h4>
<section><p>Sorts SuggestWord instances</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.SuggestWordScoreComparer.html">SuggestWordScoreComparer</a></h4>
<section><p>Score first, then frequency</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.TermFreqIteratorWrapper.html">TermFreqIteratorWrapper</a></h4>
<section><p>Wraps a BytesRefIterator as a TermFreqIterator, with all weights
set to <pre><code>1</code></pre></p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.WordBreakSpellChecker.html">WordBreakSpellChecker</a></h4>
<section><p>
A spell checker whose sole function is to offer suggestions by combining
multiple terms into one word and/or breaking terms into multiple words.
</p>
</section>
<h3 id="interfaces">Interfaces
</h3>
<h4><a class="xref" href="Lucene.Net.Search.Spell.IDictionary.html">IDictionary</a></h4>
<section><p>A simple interface representing a Dictionary. A Dictionary
here is a list of entries, where every entry consists of
term, weight and payload.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.IStringDistance.html">IStringDistance</a></h4>
<section><p>Interface for string distances.</p>
</section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.ITermFreqIterator.html">ITermFreqIterator</a></h4>
<section><p>Interface for enumerating term,weight pairs.</p>
</section>
<h3 id="enums">Enums
</h3>
<h4><a class="xref" href="Lucene.Net.Search.Spell.SuggestMode.html">SuggestMode</a></h4>
<section><p>Set of strategies for suggesting related terms</p>
<div class="lucene-block lucene-experimental">This is a Lucene.NET EXPERIMENTAL API, use at your own risk</div></section>
<h4><a class="xref" href="Lucene.Net.Search.Spell.WordBreakSpellChecker.BreakSuggestionSortMethod.html">WordBreakSpellChecker.BreakSuggestionSortMethod</a></h4>
<section><p>Determines the order to list word break suggestions</p>
</section>
</article>
</div>
<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/apache/lucenenet/blob/docs/4.8.0-beta00010/src/Lucene.Net.Suggest/Spell/package.md/#L2" class="contribution-link">Improve this Doc</a>
</li>
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>
<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>
Copyright © 2020 Licensed to the Apache Software Foundation (ASF)
</div>
</div>
</footer>
</div>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.vendor.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/docfx.js"></script>
<script type="text/javascript" src="https://lucenenet.apache.org/docs/4.8.0-beta00009/styles/main.js"></script>
</body>
</html>