SILUBS.ScriptureChecks.ProcessMixedCapitalization.ProcessWord C# (CSharp) Method

ProcessWord() public method

public ProcessWord ( ITextToken tok, WordAndPunct wap, string desiredKey ) : void
tok ITextToken
wap SILUBS.SharedScrUtils.WordAndPunct
desiredKey string
return void
		public void ProcessWord(ITextToken tok, WordAndPunct wap, string desiredKey)
		{
			AWord word = new AWord(wap.Word, m_categorizer);

			if (word.Prefix == string.Empty && word.Suffix == string.Empty)
				return;
			if (m_uncapitalizedPrefixes.Contains(word.Prefix))
				return;
			if (m_uncapitalizedPrefixes.Contains("*" + word.Prefix[word.Prefix.Length - 1]))
				return;
			if (m_uncapitalizedPrefixes.Contains("*"))
				return;
			if (m_capitalizedSuffixes.Contains(word.Suffix))
				return;
			if (m_capitalizedPrefixes.Contains(word.Prefix))
				return;

			AddWord(tok, wap, desiredKey);
		}

Usage Example

Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Get all instances of the item being checked in the token list passed.
        /// This includes both valid and invalid instances.
        /// This is used 1) to create an inventory of these items.
        /// To show the user all instance of an item with a specified key.
        /// 2) With a "desiredKey" in order to fetch instance of a specific
        /// item (e.g. all the places where "the" is a repeated word.
        /// </summary>
        /// <param name="tokens">Tokens for text to be scanned</param>
        /// <param name="desiredKey">If you only want instance of a specific key (e.g. one word,
        /// one punctuation pattern, one character, etc.) place it here. Empty string returns
        /// all items.</param>
        /// <returns>List of token substrings</returns>
        /// ------------------------------------------------------------------------------------
        public List <TextTokenSubstring> GetReferences(IEnumerable <ITextToken> tokens, string desiredKey)
        {
#if DEBUG
            List <ITextToken> AllTokens = new List <ITextToken>(tokens);
            if (AllTokens.Count == 0)
            {
                // Keep the compiler from complaining about assigning to a variable, but not using it.
            }
#endif
            m_characterCategorizer = m_checksDataSource.CharacterCategorizer;
            ValidItems             = m_checksDataSource.GetParameterValue(kValidItemsParameter);
            InvalidItems           = m_checksDataSource.GetParameterValue(kInvalidItemsParameter);

            string preferredLocale =
                m_checksDataSource.GetParameterValue("PreferredLocale") ?? string.Empty;

            m_mixedCapitalization = new List <TextTokenSubstring>();
            ProcessMixedCapitalization processor =
                new ProcessMixedCapitalization(m_checksDataSource, m_mixedCapitalization);

            foreach (ITextToken tok in tokens)
            {
                if ((tok.Locale ?? string.Empty) != preferredLocale)
                {
                    continue;
                }

                foreach (WordAndPunct wap in m_characterCategorizer.WordAndPuncts(tok.Text))
                {
                    processor.ProcessWord(tok, wap, desiredKey);
                }
            }

            return(m_mixedCapitalization);
        }
All Usage Examples Of SILUBS.ScriptureChecks.ProcessMixedCapitalization::ProcessWord