1 package org.apache.lucene.analysis.hi;
3 import java.util.HashSet;
6 import org.apache.lucene.analysis.Analyzer;
7 import org.apache.lucene.analysis.BaseTokenStreamTestCase;
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
17 * http://www.apache.org/licenses/LICENSE-2.0
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.
27 * Tests the HindiAnalyzer
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);
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, "हिंदी", "हिंद");
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, "हिंदी", "हिंदी");
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);