Ejemplo n.º 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;
		}
Ejemplo n.º 2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="QuotationMarkCategorizer"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		internal QuotationMarkCategorizer(IChecksDataSource source)
		{
			m_quoteMarks = QuotationMarksList.Load(source.GetParameterValue("QuotationMarkInfo"),
				source.GetParameterValue("DefaultWritingSystemName"));
			m_styleInfo = StylePropsInfo.Load(source.GetParameterValue("StylesInfo"));
			CollapseAdjacentQuotes = source.GetParameterValue("CollapseAdjacentQuotes") == "No";
		}