Package org.apache.lucene.analysis.util

Examples of org.apache.lucene.analysis.util.ClasspathResourceLoader


    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    ElisionFilterFactory factory = new ElisionFilterFactory();
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    Map<String, String> args = Collections.emptyMap();
    factory.init(args);
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    factory.inform(loader);
    TokenStream stream = factory.create(tokenizer);
    assertTokenStreamContents(stream, new String[] { "avion" });
  }
View Full Code Here


  public void testCaseInsensitive() throws Exception {
    Reader reader = new StringReader("L'avion");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    ElisionFilterFactory factory = new ElisionFilterFactory();
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    Map<String,String> args = new HashMap<String,String>();
    args.put("articles", "frenchArticles.txt");
    args.put("ignoreCase", "true");
    factory.init(args);
    factory.inform(loader);
View Full Code Here

    Map<String,String> args = new HashMap<String,String>();
    args.put("dictionary", "test.dic");
    args.put("affix", "test.aff");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    factory.init(args);
    factory.inform(new ClasspathResourceLoader(getClass()));
   
    Reader reader = new StringReader("abc");
    TokenStream stream = factory.create(new MockTokenizer(reader, MockTokenizer.WHITESPACE, false));
    assertTokenStreamContents(stream, new String[] { "ab" });
  }
View Full Code Here

    try {
      factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
      factory.init(Collections.<String,String>emptyMap());
      if (factory instanceof ResourceLoaderAware) {
        ResourceLoaderAware resourceLoaderAware = (ResourceLoaderAware) factory;
          resourceLoaderAware.inform(new ClasspathResourceLoader(factory.getClass()));
      }
      success = true;
    } catch (IllegalArgumentException ignored) {
      // its ok if we dont provide the right parameters to throw this
    }
View Full Code Here

*
**/
public class TestKeepFilterFactory extends BaseTokenStreamTestCase {

  public void testInform() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    assertTrue("loader is null and it shouldn't be", loader != null);
    KeepWordFilterFactory factory = new KeepWordFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "keep-1.txt");
    args.put("ignoreCase", "true");
View Full Code Here

* so this won't break if stop filter test files change
**/
public class TestCommonGramsQueryFilterFactory extends BaseTokenStreamTestCase {

  public void testInform() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(TestStopFilter.class);
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsQueryFilterFactory factory = new CommonGramsQueryFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "stop-1.txt");
    args.put("ignoreCase", "true");
View Full Code Here

 
  /**
   * If no words are provided, then a set of english default stopwords is used.
   */
  public void testDefaults() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(TestStopFilter.class);
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsQueryFilterFactory factory = new CommonGramsQueryFilterFactory();
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    Map<String, String> args = Collections.emptyMap();
    factory.init(args);
View Full Code Here

* so this won't break if stop filter test files change
**/
public class TestCommonGramsFilterFactory extends BaseTokenStreamTestCase {

  public void testInform() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(TestStopFilter.class);
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsFilterFactory factory = new CommonGramsFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("words", "stop-1.txt");
    args.put("ignoreCase", "true");
View Full Code Here

 
  /**
   * If no words are provided, then a set of english default stopwords is used.
   */
  public void testDefaults() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(TestStopFilter.class);
    assertTrue("loader is null and it shouldn't be", loader != null);
    CommonGramsFilterFactory factory = new CommonGramsFilterFactory();
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    Map<String, String> args = Collections.emptyMap();
    factory.init(args);
View Full Code Here

public class TestICUTokenizerFactory extends BaseTokenStreamTestCase {
  public void testMixedText() throws Exception {
    Reader reader = new StringReader("การที่ได้ต้องแสดงว่างานดี  This is a test ກວ່າດອກ");
    ICUTokenizerFactory factory = new ICUTokenizerFactory();
    factory.init(new HashMap<String,String>());
    factory.inform(new ClasspathResourceLoader(getClass()));
    TokenStream stream = factory.create(reader);
    assertTokenStreamContents(stream,
        new String[] { "การ", "ที่", "ได้", "ต้อง", "แสดง", "ว่า", "งาน", "ดี",
        "This", "is", "a", "test", "ກວ່າ", "ດອກ"});
  }
View Full Code Here

TOP

Related Classes of org.apache.lucene.analysis.util.ClasspathResourceLoader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.