• 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;
            }


        }

  • 相关阅读:
    数据库知识点
    hibernate5--主键生成策略
    hibernate5学习知识点小结
    hibernate5小案例讲解
    hibernate5新手跳过的坑
    strut2_struts.xml文件配置知识点汇集
    在使用ElementUI的JSP项目中,集成富文本编辑器QuillEditor
    如何在JSP中使用VUE/elementUI
    Java定时任务--Timer和TimerTask
    SecureFX的破解问题
  • 原文地址:https://www.cnblogs.com/wycg1984/p/1722402.html
Copyright © 2020-2023  润新知