private void CheckSynonymList(TokenSource source, HashSet <List <TermSegment> > synonymList)
        {
            var synonym = synonymList.Where(x => x.Contains(new TermSegment(source.Buffer, source.Size))).FirstOrDefault();

            if (synonym != null)
            {
                TermSegment term = synonym.FirstOrDefault();
                source.Size = term._buffer.Length;
                for (int i = 0; i < term._buffer.Length; i++)
                {
                    source.Buffer[i] = term._buffer[i];
                }
            }
        }
Ejemplo n.º 2
0
        public bool Process(TokenSource source)
        {
            var term = new TermSegment(source.Buffer, source.Size);

            return(!_stopWords.Contains(term));
        }