4 namespace Lucene
.Net
.Analysis
6 /* ====================================================================
7 * The Apache Software License, Version 1.1
9 * Copyright (c) 2001 The Apache Software Foundation. All rights
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in
21 * the documentation and/or other materials provided with the
24 * 3. The end-user documentation included with the redistribution,
25 * if any, must include the following acknowledgment:
26 * "This product includes software developed by the
27 * Apache Software Foundation (http://www.apache.org/)."
28 * Alternately, this acknowledgment may appear in the software itself,
29 * if and wherever such third-party acknowledgments normally appear.
31 * 4. The names "Apache" and "Apache Software Foundation" and
32 * "Apache Lucene" must not be used to endorse or promote products
33 * derived from this software without prior written permission. For
34 * written permission, please contact apache@apache.org.
36 * 5. Products derived from this software may not be called "Apache",
37 * "Apache Lucene", nor may "Apache" appear in their name, without
38 * prior written permission of the Apache Software Foundation.
40 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
41 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
42 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
43 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
44 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
47 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
48 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
49 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
50 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
52 * ====================================================================
54 * This software consists of voluntary contributions made by many
55 * individuals on behalf of the Apache Software Foundation. For more
56 * information on the Apache Software Foundation, please see
57 * <http://www.apache.org/>.
61 /// An Analyzer builds TokenStreams, which analyze text. It thus represents a
62 /// policy for extracting index terms from text.
64 /// Typical implementations first build a Tokenizer, which breaks the stream of
65 /// characters from the TextReader into raw Tokens. One or more TokenFilters may
66 /// then be applied to the output of the Tokenizer.
69 /// WARNING: You must override one of the methods defined by this class in your
70 /// subclass or the Analyzer will enter an infinite loop.
73 public abstract class Analyzer
76 /// Creates a TokenStream which tokenizes all the text in the provided
77 /// TextReader. Default implementation forwards to TokenStream(TextReader) for
78 /// compatibility with older version. Override to allow Analyzer to choose
79 /// strategy based on document and/or field. Must be able to handle null
80 /// field name for backward compatibility.
82 /// <param name="fieldName"></param>
83 /// <param name="reader"></param>
84 /// <returns></returns>
85 public virtual TokenStream
TokenStream(String fieldName
, TextReader reader
)
87 // implemented for backward compatibility
88 return TokenStream(reader
);
92 /// Creates a TokenStream which tokenizes all the text in the provided
93 /// TextReader. Provided for backward compatibility only.
94 /// <see cref="TokenStream(String, TextReader)"/>
96 /// <param name="reader"></param>
97 /// <returns></returns>
98 /// <remarks>deprecated, use TokenStream(String, TextReader) instead.</remarks>
99 public virtual TokenStream
TokenStream(TextReader reader
)
101 return TokenStream(null, reader
);