Example #1
0
        /// <summary>
        /// Validate pos string.
        /// </summary>
        /// <param name="posStr">Pos string to be validated.</param>
        /// <param name="ttsPosSet">Tts pos set for validation.</param>
        /// <param name="attributeSchema">Lexicon attribute schema for validation.</param>
        /// <returns>Validate result.</returns>
        public static ErrorSet Validate(string posStr, TtsPosSet ttsPosSet,
            LexicalAttributeSchema attributeSchema)
        {
            ErrorSet errorSet = new ErrorSet();
            if ((attributeSchema != null && string.IsNullOrEmpty(attributeSchema.GenerateString(
                LexicalAttributeSchema.PosCategoryName, posStr))) ||
                (ttsPosSet != null && !ttsPosSet.Items.ContainsKey(posStr)))
            {
                errorSet.Add(PosError.UnrecognizedPos, posStr);
            }

            return errorSet;
        }