2 * Copyright 2004 The Apache Software Foundation
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 namespace Lucene
.Net
.Analysis
20 /// <summary>An Analyzer builds TokenStreams, which analyze text. It thus represents a
21 /// policy for extracting index terms from text.
23 /// Typical implementations first build a Tokenizer, which breaks the stream of
24 /// characters from the Reader into raw Tokens. One or more TokenFilters may
25 /// then be applied to the output of the Tokenizer.
28 /// WARNING: You must override one of the methods defined by this class in your
29 /// subclass or the Analyzer will enter an infinite loop.
32 public abstract class Analyzer
34 /// <summary>Creates a TokenStream which tokenizes all the text in the provided
35 /// Reader. Default implementation forwards to tokenStream(Reader) for
36 /// compatibility with older version. Override to allow Analyzer to choose
37 /// strategy based on document and/or Field. Must be able to handle null
38 /// Field name for backward compatibility.
40 public virtual TokenStream
TokenStream(System
.String fieldName
, System
.IO
.TextReader reader
)
42 // implemented for backward compatibility
43 return TokenStream(reader
);
46 /// <summary>Creates a TokenStream which tokenizes all the text in the provided
47 /// Reader. Provided for backward compatibility only.
49 /// <deprecated> use TokenStream(String, Reader) instead.
51 /// <seealso cref="Reader)">
53 public virtual TokenStream
TokenStream(System
.IO
.TextReader reader
)
55 return TokenStream(null, reader
);