Package org.apache.lucene.analysis.util

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


  public void testLoadRules() throws Exception {
    Map<String, String> args = new HashMap<String, String>();
    args.put( "synonyms", "something.txt" );
    SlowSynonymFilterFactory ff = new SlowSynonymFilterFactory(args);
    ff.inform( new ResourceLoader() {

      @Override
      public <T> T newInstance(String cname, Class<T> expectedType) {
        throw new RuntimeException("stub");
      }
View Full Code Here


   * @throws IOException
   */
  public static Analyzer buildAnalyzer(AnalyzerDef analyzerDef,
      Version luceneMatchVersion,
      ServiceManager serviceManager) throws IOException {
    ResourceLoader defaultResourceLoader = new HibernateSearchResourceLoader( serviceManager );
    TokenizerDef token = analyzerDef.tokenizer();
    final Map<String, String> tokenMapsOfParameters = getMapOfParameters( token.params(), luceneMatchVersion );
    TokenizerFactory tokenFactory = instanceFromClass(
        TokenizerFactory.class,
        token.factory(),
View Full Code Here

*
**/
public class TestStopFilterFactory extends BaseTokenStreamTestCase {

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

*/
public class TestTypeTokenFilterFactory extends BaseTokenStreamTestCase {

  @Test
  public void testInform() throws Exception {
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    TypeTokenFilterFactory factory = new TypeTokenFilterFactory();
    Map<String, String> args = new HashMap<String, String>();
    args.put("types", "stoptypes-1.txt");
    args.put("enablePositionIncrements", "true");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
View Full Code Here

  public void testLoadRules() throws Exception {
    Map<String, String> args = new HashMap<String, String>();
    args.put( "synonyms", "something.txt" );
    SlowSynonymFilterFactory ff = new SlowSynonymFilterFactory();
    ff.init(args);
    ff.inform( new ResourceLoader() {

      @Override
      public <T> T newInstance(String cname, Class<T> expectedType) {
        throw new RuntimeException("stub");
      }
View Full Code Here

   */
  public void testDecompounding() throws Exception {
    Reader reader = new StringReader("I like to play softball");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    DictionaryCompoundWordTokenFilterFactory factory = new DictionaryCompoundWordTokenFilterFactory();
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    Map<String,String> args = new HashMap<String,String>();
    args.put("dictionary", "compoundDictionary.txt");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    factory.init(args);
    factory.inform(loader);
View Full Code Here

   */
  public void testHyphenationWithDictionary() throws Exception {
    Reader reader = new StringReader("min veninde som er lidt af en læsehest");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    HyphenationCompoundWordTokenFilterFactory factory = new HyphenationCompoundWordTokenFilterFactory();
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    Map<String,String> args = new HashMap<String,String>();
    args.put("hyphenator", "da_UTF8.xml");
    args.put("dictionary", "da_compoundDictionary.txt");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    factory.init(args);
View Full Code Here

    // our stemdict stems dogs to 'cat'
    Reader reader = new StringReader("testing dogs");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    StemmerOverrideFilterFactory factory = new StemmerOverrideFilterFactory();
    Map<String,String> args = new HashMap<String,String>();
    ResourceLoader loader = new StringMockResourceLoader("dogs\tcat");
    args.put("dictionary", "stemdict.txt");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    factory.init(args);
    factory.inform(loader);
   
View Full Code Here

  public void testKeywordsCaseInsensitive() throws IOException {
    Reader reader = new StringReader("testing DoGs");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    StemmerOverrideFilterFactory factory = new StemmerOverrideFilterFactory();
    Map<String,String> args = new HashMap<String,String>();
    ResourceLoader loader = new StringMockResourceLoader("dogs\tcat");
    args.put("dictionary", "stemdict.txt");
    args.put("ignoreCase", "true");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
    factory.init(args);
    factory.inform(loader);
View Full Code Here

   */
  public void testHyphenationOnly() throws Exception {
    Reader reader = new StringReader("basketballkurv");
    Tokenizer tokenizer = new MockTokenizer(reader, MockTokenizer.WHITESPACE, false);
    HyphenationCompoundWordTokenFilterFactory factory = new HyphenationCompoundWordTokenFilterFactory();
    ResourceLoader loader = new ClasspathResourceLoader(getClass());
    Map<String,String> args = new HashMap<String,String>();
    args.put("hyphenator", "da_UTF8.xml");
    args.put("minSubwordSize", "2");
    args.put("maxSubwordSize", "4");
    factory.setLuceneMatchVersion(TEST_VERSION_CURRENT);
View Full Code Here

TOP

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

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.