Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class WordBreakSpellChecker

    A spell checker whose sole function is to offer suggestions by combining multiple terms into one word and/or breaking terms into multiple words.

    Inheritance
    System.Object
    WordBreakSpellChecker
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Lucene.Net.Search.Spell
    Assembly: Lucene.Net.Suggest.dll
    Syntax
    public class WordBreakSpellChecker

    Constructors

    | Improve this Doc View Source

    WordBreakSpellChecker()

    Creates a new spellchecker with default configuration values

    Declaration
    public WordBreakSpellChecker()
    See Also
    MaxChanges
    MaxCombineWordLength
    MaxEvaluations
    MinBreakWordLength
    MinSuggestionFrequency

    Fields

    | Improve this Doc View Source

    SEPARATOR_TERM

    Term that can be used to prohibit adjacent terms from being combined

    Declaration
    public static readonly Term SEPARATOR_TERM
    Field Value
    Type Description
    Lucene.Net.Index.Term

    Properties

    | Improve this Doc View Source

    MaxChanges

    Gets or sets the maximum numbers of changes (word breaks or combinations) to make on the original term(s). Default=1.

    Declaration
    public virtual int MaxChanges { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    MaxCombineWordLength

    Gets or sets the maximum length of a suggestion made by combining 1 or more original terms. Default=20.

    Declaration
    public virtual int MaxCombineWordLength { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    MaxEvaluations

    Gets or sets the maximum number of word combinations to evaluate. Default=1000. A higher value might improve result quality. A lower value might improve performance.

    Declaration
    public virtual int MaxEvaluations { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    MinBreakWordLength

    Gets or sets the minimum length to break words down to. Default=1.

    Declaration
    public virtual int MinBreakWordLength { get; set; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    MinSuggestionFrequency

    Gets or sets the minimum frequency a term must have to be included as part of a suggestion. Default=1 Not applicable when used with SUGGEST_MORE_POPULAR

    Declaration
    public virtual int MinSuggestionFrequency { get; set; }
    Property Value
    Type Description
    System.Int32

    Methods

    | Improve this Doc View Source

    SuggestWordBreaks(Term, Int32, IndexReader, SuggestMode, WordBreakSpellChecker.BreakSuggestionSortMethod)

    Generate suggestions by breaking the passed-in term into multiple words. The scores returned are equal to the number of word breaks needed so a lower score is generally preferred over a higher score.

    Declaration
    public virtual SuggestWord[][] SuggestWordBreaks(Term term, int maxSuggestions, IndexReader ir, SuggestMode suggestMode = SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX, WordBreakSpellChecker.BreakSuggestionSortMethod sortMethod = WordBreakSpellChecker.BreakSuggestionSortMethod.NUM_CHANGES_THEN_MAX_FREQUENCY)
    Parameters
    Type Name Description
    Lucene.Net.Index.Term term
    System.Int32 maxSuggestions
    Lucene.Net.Index.IndexReader ir
    SuggestMode suggestMode
    • default = SUGGEST_WHEN_NOT_IN_INDEX
    WordBreakSpellChecker.BreakSuggestionSortMethod sortMethod
    • default = NUM_CHANGES_THEN_MAX_FREQUENCY
    Returns
    Type Description
    SuggestWord[][]

    one or more arrays of words formed by breaking up the original term

    Exceptions
    Type Condition
    System.IO.IOException

    If there is a low-level I/O error.

    | Improve this Doc View Source

    SuggestWordCombinations(Term[], Int32, IndexReader, SuggestMode)

    Generate suggestions by combining one or more of the passed-in terms into single words. The returned CombineSuggestion contains both a SuggestWord and also an array detailing which passed-in terms were involved in creating this combination. The scores returned are equal to the number of word combinations needed, also one less than the length of the array OriginalTermIndexes. Generally, a suggestion with a lower score is preferred over a higher score.

    To prevent two adjacent terms from being combined (for instance, if one is mandatory and the other is prohibited), separate the two terms with SEPARATOR_TERM

    When suggestMode equals SUGGEST_WHEN_NOT_IN_INDEX, each suggestion will include at least one term not in the index.

    When suggestMode equals SUGGEST_MORE_POPULAR, each suggestion will have the same, or better frequency than the most-popular included term.

    Declaration
    public virtual CombineSuggestion[] SuggestWordCombinations(Term[] terms, int maxSuggestions, IndexReader ir, SuggestMode suggestMode = SuggestMode.SUGGEST_WHEN_NOT_IN_INDEX)
    Parameters
    Type Name Description
    Lucene.Net.Index.Term[] terms
    System.Int32 maxSuggestions
    Lucene.Net.Index.IndexReader ir
    SuggestMode suggestMode
    Returns
    Type Description
    CombineSuggestion[]

    an array of words generated by combining original terms

    Exceptions
    Type Condition
    System.IO.IOException

    If there is a low-level I/O error.

    • Improve this Doc
    • View Source
    Back to top Copyright © 2022 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.