Exemplo n.º 1
0
        protected override bool IsValid(PropertyValidatorContext context)
        {
            var tokens = context.PropertyValue as IList <Token>;

            foreach (var token in tokens)
            {
                // For some reason, even if a word fails NLP's .isKnown check, it'll still have a valid NER attached to it, so we'll check for that
                if ((_loadedCoreNlpLexModel.getLexicon().isKnown(token.word)) || (token.ner != "O"))
                {
                    _tokensFoundInNlpLex.Add(token);
                }
                else
                {
                    _tokensNotFoundInNlpLex.Add(token);
                }
            }

            if (_tokensNotFoundInNlpLex.Count > 0)
            {
                return(false);
            }
            return(true);
        }