C# 클래스 Lucene.Net.Analysis.MockAnalyzer

Analyzer for testing

this analyzer is a replacement for Whitespace/Simple/KeywordAnalyzers for unit tests. If you are testing a custom component such as a queryparser or analyzer-wrapper that consumes analysis streams, its a great idea to test it with this analyzer instead. MockAnalyzer has the following behavior:

  • By default, the assertions in MockTokenizer are turned on for extra checks that the consumer is consuming properly. These checks can be disabled with #setEnableChecks(boolean).
  • Payload data is randomly injected into the stream for more thorough testing of payloads.
상속: Analyzer
파일 보기 프로젝트 열기: paulirwin/lucene.net 1 사용 예제들

공개 메소드들

메소드 설명
CreateComponents ( string fieldName, TextReader reader ) : TokenStreamComponents
GetOffsetGap ( string fieldName ) : int

Get the offset gap between tokens in fields if several fields with the same name were added.

GetPositionIncrementGap ( string fieldName ) : int
MockAnalyzer ( Random random ) : System

Create a Whitespace-lowercasing analyzer with no stopwords removal.

Calls {@link #MockAnalyzer(Random, CharacterRunAutomaton, boolean, CharacterRunAutomaton) MockAnalyzer(random, MockTokenizer.WHITESPACE, true, MockTokenFilter.EMPTY_STOPSET, false}).

MockAnalyzer ( Random random, CharacterRunAutomaton runAutomaton, bool lowerCase ) : System

Calls {@link #MockAnalyzer(Random, CharacterRunAutomaton, boolean, CharacterRunAutomaton) MockAnalyzer(random, runAutomaton, lowerCase, MockTokenFilter.EMPTY_STOPSET, false}).

MockAnalyzer ( Random random, CharacterRunAutomaton runAutomaton, bool lowerCase, CharacterRunAutomaton filter ) : System

Creates a new MockAnalyzer.

비공개 메소드들

메소드 설명
MaybePayload ( Lucene.Net.Analysis.TokenFilter stream, string fieldName ) : Lucene.Net.Analysis.TokenFilter

메소드 상세

CreateComponents() 공개 메소드

public CreateComponents ( string fieldName, TextReader reader ) : TokenStreamComponents
fieldName string
reader System.IO.TextReader
리턴 TokenStreamComponents

GetOffsetGap() 공개 메소드

Get the offset gap between tokens in fields if several fields with the same name were added.
public GetOffsetGap ( string fieldName ) : int
fieldName string Currently not used, the same offset gap is returned for each field.
리턴 int

GetPositionIncrementGap() 공개 메소드

public GetPositionIncrementGap ( string fieldName ) : int
fieldName string
리턴 int

MockAnalyzer() 공개 메소드

Create a Whitespace-lowercasing analyzer with no stopwords removal.

Calls {@link #MockAnalyzer(Random, CharacterRunAutomaton, boolean, CharacterRunAutomaton) MockAnalyzer(random, MockTokenizer.WHITESPACE, true, MockTokenFilter.EMPTY_STOPSET, false}).

public MockAnalyzer ( Random random ) : System
random System.Random
리턴 System

MockAnalyzer() 공개 메소드

Calls {@link #MockAnalyzer(Random, CharacterRunAutomaton, boolean, CharacterRunAutomaton) MockAnalyzer(random, runAutomaton, lowerCase, MockTokenFilter.EMPTY_STOPSET, false}).
public MockAnalyzer ( Random random, CharacterRunAutomaton runAutomaton, bool lowerCase ) : System
random System.Random
runAutomaton CharacterRunAutomaton
lowerCase bool
리턴 System

MockAnalyzer() 공개 메소드

Creates a new MockAnalyzer.
public MockAnalyzer ( Random random, CharacterRunAutomaton runAutomaton, bool lowerCase, CharacterRunAutomaton filter ) : System
random System.Random Random for payloads behavior
runAutomaton CharacterRunAutomaton DFA describing how tokenization should happen (e.g. [a-zA-Z]+)
lowerCase bool true if the tokenizer should lowercase terms
filter CharacterRunAutomaton DFA describing how terms should be filtered (set of stopwords, etc)
리턴 System