コード例 #1
0
        private Token searchToken(ITokenizer tokenizer, string term, bool search)
        {
            _offset += 1;
            var result = tokenizer.QueryToken(_offset, false);

            while (result != null)
            {
                if (!result.IsWord())
                {
                    if (search && (EnglishInterpreter.PhraseEndings.Contains(result.Text)))
                    {
                        result = null;
                    }
                    else
                    {
                        _offset += 1;
                        result   = tokenizer.QueryToken(_offset, false);
                    }
                }
                else if (result.Text == term)
                {
                    break;
                }
                else
                {
                    if (!search)
                    {
                        result = null;
                    }
                    else
                    {
                        _offset += 1;
                        result   = tokenizer.QueryToken(_offset, false);
                    }
                }
            }
            return(result);
        }