add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / contrib / analyzers / common / src / test / org / apache / lucene / analysis / hi / TestHindiAnalyzer.java
1 package org.apache.lucene.analysis.hi;
2
3 import java.util.HashSet;
4 import java.util.Set;
5
6 import org.apache.lucene.analysis.Analyzer;
7 import org.apache.lucene.analysis.BaseTokenStreamTestCase;
8
9 /**
10  * Licensed to the Apache Software Foundation (ASF) under one or more
11  * contributor license agreements.  See the NOTICE file distributed with
12  * this work for additional information regarding copyright ownership.
13  * The ASF licenses this file to You under the Apache License, Version 2.0
14  * (the "License"); you may not use this file except in compliance with
15  * the License.  You may obtain a copy of the License at
16  *
17  *     http://www.apache.org/licenses/LICENSE-2.0
18  *
19  * Unless required by applicable law or agreed to in writing, software
20  * distributed under the License is distributed on an "AS IS" BASIS,
21  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22  * See the License for the specific language governing permissions and
23  * limitations under the License.
24  */
25
26 /**
27  * Tests the HindiAnalyzer
28  */
29 public class TestHindiAnalyzer extends BaseTokenStreamTestCase {
30   /** This test fails with NPE when the 
31    * stopwords file is missing in classpath */
32   public void testResourcesAvailable() {
33     new HindiAnalyzer(TEST_VERSION_CURRENT);
34   }
35   
36   public void testBasics() throws Exception {
37     Analyzer a = new HindiAnalyzer(TEST_VERSION_CURRENT);
38     // two ways to write 'hindi' itself.
39     checkOneTermReuse(a, "हिन्दी", "हिंद");
40     checkOneTermReuse(a, "हिंदी", "हिंद");
41   }
42   
43   public void testExclusionSet() throws Exception {
44     Set<String> exclusionSet = new HashSet<String>();
45     exclusionSet.add("हिंदी");
46     Analyzer a = new HindiAnalyzer(TEST_VERSION_CURRENT, 
47         HindiAnalyzer.getDefaultStopSet(), exclusionSet);
48     checkOneTermReuse(a, "हिंदी", "हिंदी");
49   }
50   
51   /** blast some random strings through the analyzer */
52   public void testRandomStrings() throws Exception {
53     checkRandomData(random, new HindiAnalyzer(TEST_VERSION_CURRENT), 10000*RANDOM_MULTIPLIER);
54   }
55 }