zoukankan      html  css  js  c++  java
  • lucene下的一个自定义分词

    public class ICTCLASAnalyzer : Analyzer
        {
            //定义要过滤的词
            public static readonly System.String[] CHINESE_ENGLISH_STOP_WORDS = new string[428];
            public string NoisePath = Environment.CurrentDirectory + "\\data\\stopwords.txt";
            public ICTCLASAnalyzer()
            {
                StreamReader reader = new StreamReader(NoisePath, System.Text.Encoding.Default);
                string noise = reader.ReadLine();
                int i = 0;
                while (!string.IsNullOrEmpty(noise))
                {
                    CHINESE_ENGLISH_STOP_WORDS[i] = noise;
                    noise = reader.ReadLine();
                    i++;
                    if (i >= 428)
                        break;
                }
            }

            public override TokenStream TokenStream(System.String fieldName, System.IO.TextReader reader)
            {
                TokenStream result = new ICTCLASTokenizer(reader);
                result = new StandardFilter(result);
                result = new LowerCaseFilter(result);
              
                result = new StopFilter(result, CHINESE_ENGLISH_STOP_WORDS);
                return result;
            }


        }

  • 相关阅读:
    apk反编译
    Hybrid App
    Hybrid App
    Hybrid App
    Hybrid App 介绍
    android-adb
    .java生成dex文件
    android Activity launch mode 知识点总结
    2018.10.15学习总结
    2018.10.12
  • 原文地址:https://www.cnblogs.com/wycg1984/p/1722402.html
Copyright © 2011-2022 走看看