public void testDefaultsKuromojiAnalysis() throws IOException {
    AnalysisService analysisService = createAnalysisService();

    TokenizerFactory tokenizerFactory = analysisService.tokenizer("kuromoji_tokenizer");
    assertThat(tokenizerFactory, instanceOf(KuromojiTokenizerFactory.class));

    TokenFilterFactory filterFactory = analysisService.tokenFilter("kuromoji_part_of_speech");
    assertThat(filterFactory, instanceOf(KuromojiPartOfSpeechFilterFactory.class));

    filterFactory = analysisService.tokenFilter("kuromoji_readingform");
    assertThat(filterFactory, instanceOf(KuromojiReadingFormFilterFactory.class));

    filterFactory = analysisService.tokenFilter("kuromoji_baseform");
    assertThat(filterFactory, instanceOf(KuromojiBaseFormFilterFactory.class));

    filterFactory = analysisService.tokenFilter("kuromoji_stemmer");
    assertThat(filterFactory, instanceOf(KuromojiKatakanaStemmerFactory.class));

    filterFactory = analysisService.tokenFilter("ja_stop");
    assertThat(filterFactory, instanceOf(JapaneseStopTokenFilterFactory.class));

    NamedAnalyzer analyzer = analysisService.analyzer("kuromoji");
    assertThat(analyzer.analyzer(), instanceOf(JapaneseAnalyzer.class));

    analyzer = analysisService.analyzer("my_analyzer");
    assertThat(analyzer.analyzer(), instanceOf(CustomAnalyzer.class));
    assertThat(
        analyzer.analyzer().tokenStream(null, new StringReader("")),
        instanceOf(JapaneseTokenizer.class));

    CharFilterFactory charFilterFactory = analysisService.charFilter("kuromoji_iteration_mark");
    assertThat(charFilterFactory, instanceOf(KuromojiIterationMarkCharFilterFactory.class));
  }
  @Test
  public void testArirangAnalysis() {
    Index index = new Index("test");
    Settings settings =
        settingsBuilder()
            .put("path.home", "/Users/hwjeong/temp/tmp")
            .put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT)
            .build();
    Injector parentInjector =
        new ModulesBuilder()
            .add(
                new SettingsModule(EMPTY_SETTINGS),
                new EnvironmentModule(new Environment(settings)))
            .createInjector();
    Injector injector =
        new ModulesBuilder()
            .add(
                new IndexSettingsModule(index, settings),
                new IndexNameModule(index),
                new AnalysisModule(
                        EMPTY_SETTINGS, parentInjector.getInstance(IndicesAnalysisService.class))
                    .addProcessor(new ArirangAnalysisBinderProcessor()))
            .createChildInjector(parentInjector);

    AnalysisService analysisService = injector.getInstance(AnalysisService.class);

    TokenizerFactory tokenizerFactory = analysisService.tokenizer("arirang_tokenizer");
    MatcherAssert.assertThat(tokenizerFactory, instanceOf(ArirangTokenizerFactory.class));
  }
  public void testKuromojiUserDict() throws IOException {
    AnalysisService analysisService = createAnalysisService();
    TokenizerFactory tokenizerFactory = analysisService.tokenizer("kuromoji_user_dict");
    String source = "私は制限スピードを超える。";
    String[] expected = new String[] {"私", "は", "制限スピード", "を", "超える"};

    Tokenizer tokenizer = tokenizerFactory.create();
    tokenizer.setReader(new StringReader(source));
    assertSimpleTSOutput(tokenizer, expected);
  }
 // fix #59
 public void testKuromojiEmptyUserDict() throws IOException {
   AnalysisService analysisService = createAnalysisService();
   TokenizerFactory tokenizerFactory = analysisService.tokenizer("kuromoji_empty_user_dict");
   assertThat(tokenizerFactory, instanceOf(KuromojiTokenizerFactory.class));
 }