ProcessToken() 공개 메소드

Processes the Scripture token.
public ProcessToken ( ITextToken tok, List result ) : void
tok ITextToken The token.
result List The result.
리턴 void
예제 #1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Gets the references where capitalization errors occurred.
        /// </summary>
        /// <param name="tokens">The Scripture tokens.</param>
        /// <returns>list of capitalization errors.</returns>
        /// ------------------------------------------------------------------------------------
        public List <TextTokenSubstring> GetReferences(IEnumerable <ITextToken> tokens)
        {
//			m_SentenceFinalPunc = m_chkDataSource.GetParameterValue(kSentenceFinalPuncParameter);
            if (m_stylePropsInfo == null)
            {
                string styleInfo = m_chkDataSource.GetParameterValue(kStyleSheetInfoParameter);
                Debug.Assert(!string.IsNullOrEmpty(styleInfo), "Style information not provided.");
                m_stylePropsInfo = StylePropsInfo.Load(styleInfo);
                CreateCapitalStyleDictionary();
                Debug.Assert(m_allCapitalizedStyles.Count > 0, "No styles require capitalization.");
            }

            CapitalizationProcessor bodyPuncProcessor = new CapitalizationProcessor(m_chkDataSource, m_allCapitalizedStyles);
            CapitalizationProcessor notePuncProcessor = new CapitalizationProcessor(m_chkDataSource, m_allCapitalizedStyles);

            notePuncProcessor.ProcessParagraphsSeparately = true;

            m_capitalizationErrors = new List <TextTokenSubstring>();
            VerseTextToken scrTok = new VerseTextToken();

            ITextToken tok;

            foreach (ITextToken token in tokens)
            {
                if (token.TextType == TextType.Note || token.TextType == TextType.PictureCaption)
                {
                    tok = token;
                }
                else
                {
                    // Make the token one of our special capitalization text tokens.
                    scrTok.Token = token;
                    tok          = scrTok;
                }

                if (tok.TextType == TextType.Note)
                {
                    notePuncProcessor.ProcessToken(tok, m_capitalizationErrors);
                }
                else if (tok.TextType == TextType.Verse || tok.TextType == TextType.Other)
                {
                    bodyPuncProcessor.ProcessToken(tok, m_capitalizationErrors);
                }
            }

            return(m_capitalizationErrors);
        }
예제 #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the references where capitalization errors occurred.
		/// </summary>
		/// <param name="tokens">The Scripture tokens.</param>
		/// <returns>list of capitalization errors.</returns>
		/// ------------------------------------------------------------------------------------
		public List<TextTokenSubstring> GetReferences(IEnumerable<ITextToken> tokens)
		{
			m_SentenceFinalPunc = m_chkDataSource.GetParameterValue(kSentenceFinalPuncParameter);
			if (m_stylePropsInfo == null)
			{
				string styleInfo = m_chkDataSource.GetParameterValue(kStyleSheetInfoParameter);
				Debug.Assert(!string.IsNullOrEmpty(styleInfo), "Style information not provided.");
				m_stylePropsInfo = StylePropsInfo.Load(styleInfo);
				CreateCapitalStyleDictionary();
				Debug.Assert(m_allCapitalizedStyles.Count > 0, "No styles require capitalization.");
			}

			CapitalizationProcessor bodyPuncProcessor = new CapitalizationProcessor(m_chkDataSource, m_allCapitalizedStyles);
			CapitalizationProcessor notePuncProcessor = new CapitalizationProcessor(m_chkDataSource, m_allCapitalizedStyles);
			notePuncProcessor.ProcessParagraphsSeparately = true;

			m_capitalizationErrors = new List<TextTokenSubstring>();
			VerseTextToken scrTok = new VerseTextToken();

			ITextToken tok;
			foreach (ITextToken token in tokens)
			{
				if (token.TextType == TextType.Note || token.TextType == TextType.PictureCaption)
					tok = token;
				else
				{
					// Make the token one of our special capitalization text tokens.
					scrTok.Token = token;
					tok = scrTok;
				}

				if (tok.TextType == TextType.Note)
					notePuncProcessor.ProcessToken(tok, m_capitalizationErrors);
				else if (tok.TextType == TextType.Verse || tok.TextType == TextType.Other)
					bodyPuncProcessor.ProcessToken(tok, m_capitalizationErrors);
			}

			return m_capitalizationErrors;
		}