01: /**
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */package org.apache.solr.analysis;
17:
18: import java.io.*;
19: import java.util.Map;
20:
21: import org.apache.lucene.analysis.*;
22:
23: /**
24: * A <code>TokenizerFactory</code> breaks up a stream of characters
25: * into tokens.
26: *
27: * <p>
28: * TokenizerFactories are registered for <code>FieldType</code>s with the
29: * <code>IndexSchema</code> through the <code>schema.xml</code> file.
30: * </p>
31: * <p>
32: * Example <code>schema.xml</code> entry to register a TokenizerFactory
33: * implementation to tokenize fields of type "cool"
34: * </p>
35: * <pre>
36: * <fieldtype name="cool" class="solr.TextField">
37: * <analyzer>
38: * <tokenizer class="solr.StandardTokenizerFactory"/>
39: * ...
40: * </pre>
41: * <p>
42: * A single instance of any registered TokenizerFactory is created
43: * via the default constructor and is reused for each FieldType.
44: * </p>
45: * @author yonik
46: * @version $Id: TokenizerFactory.java 472574 2006-11-08 18:25:52Z yonik $
47: */
48: public interface TokenizerFactory {
49: /** <code>init</code> will be called just once, immediately after creation.
50: * <p>The args are user-level initialization parameters that
51: * may be specified when declaring a the factory in the
52: * schema.xml
53: */
54: public void init(Map<String, String> args);
55:
56: /**
57: * Accessor method for reporting the args used to initialize this factory.
58: * <p>
59: * Implementations are <strong>strongly</strong> encouraged to return
60: * the contents of the Map passed to to the init method
61: * </p>
62: */
63: public Map<String, String> getArgs();
64:
65: /** Creates a TokenStream of the specified input */
66: public TokenStream create(Reader input);
67: }
|