コード例 #1
0
ファイル: ITextUtils.cs プロジェクト: bbriggs/FieldWorks
		/// <summary>
		/// Returns the first word in the given tssWordAnn and its lower case form.
		/// </summary>
		/// <param name="tssWordAnn"></param>
		/// <param name="wsf"></param>
		/// <param name="firstFormLowered"></param>
		/// <returns>null if we couldn't find a word in the given tssWordAnn</returns>
		static internal ITsString FirstWord(ITsString tssWordAnn, ILgWritingSystemFactory wsf, out string firstFormLowered)
		{
			WordMaker wordScanner = new WordMaker(tssWordAnn, wsf);
			int ichMinFirstWord;
			int ichLimFirstWord;
			ITsString firstWord = wordScanner.NextWord(out ichMinFirstWord, out ichLimFirstWord);
			// Handle null values without crashing.  See LT-6309 for how this can happen.
			if (firstWord != null)
				firstFormLowered = wordScanner.ToLower(firstWord);
			else
				firstFormLowered = null;
			return firstWord;
		}
コード例 #2
0
ファイル: ITextUtils.cs プロジェクト: bbriggs/FieldWorks
		private void Init(FdoCache cache)
		{
			m_cache = cache;
			m_paragraphTextScanner = new WordMaker(null, cache.WritingSystemFactory);
			m_wfr = m_cache.ServiceLocator.GetInstance<IWfiWordformRepository>();
			m_wordfactory = m_cache.ServiceLocator.GetInstance<IWfiWordformFactory>();
			m_cbaf = m_cache.ServiceLocator.GetInstance<ICmBaseAnnotationFactory>();
			m_cbar = m_cache.ServiceLocator.GetInstance<ICmBaseAnnotationRepository>();
		}
コード例 #3
0
ファイル: ITextUtils.cs プロジェクト: bbriggs/FieldWorks
		/// <summary>
		/// if parsing over multiple paragraphs, use this to setup the state before
		/// </summary>
		/// <param name="para"></param>
		private void Setup(IStTxtPara para)
		{
			m_para = para;
			m_tssPara = para.Contents;

			// must prevent a first para.seg.word in an analysis ws from corrupting the parse
			// only word forms in this ws will have analyses, the rest are turned into punctuation! LT-12304
			// Until a model change is made to store the user's preffered vernacular ws,
			// the user will always be able to defeat whatever vern ws we use here.
			// For now, look for the first vern ws in the baseline text
			m_paraWs = TsStringUtils.GetFirstVernacularWs(m_para.Cache.LanguageProject.VernWss, m_para.Services.WritingSystemFactory, m_para.Contents);
			if (m_paraWs <= 0)
				m_paraWs = m_cache.DefaultVernWs;
			m_wordMaker = new WordMaker(m_tssPara, para.Cache.WritingSystemFactory);
			m_paragraphTextScanner.Tss = m_tssPara;
		}
コード例 #4
0
ファイル: ITextUtils.cs プロジェクト: bbriggs/FieldWorks
		/// <summary>
		/// Executes in two distinct scenarios.
		///
		/// 1. If disposing is true, the method has been called directly
		/// or indirectly by a user's code via the Dispose method.
		/// Both managed and unmanaged resources can be disposed.
		///
		/// 2. If disposing is false, the method has been called by the
		/// runtime from inside the finalizer and you should not reference (access)
		/// other managed objects, as they already have been garbage collected.
		/// Only unmanaged resources can be disposed.
		/// </summary>
		/// <param name="disposing"></param>
		/// <remarks>
		/// If any exceptions are thrown, that is fine.
		/// If the method is being done in a finalizer, it will be ignored.
		/// If it is thrown by client code calling Dispose,
		/// it needs to be handled by fixing the bug.
		///
		/// If subclasses override this method, they should call the base implementation.
		/// </remarks>
		protected virtual void Dispose(bool disposing)
		{
			System.Diagnostics.Debug.WriteLineIf(!disposing, "****** Missing Dispose() call for " + GetType().Name + ". ****** ");
			// Must not be run more than once.
			if (m_isDisposed)
				return;

			if (disposing)
			{
				if (RebuildingConcordanceWordforms)
					RebuildingConcordanceWordforms = false;	// don't get rid of m_wfi until we do this.
			}
			m_wordformAnnotationPossibilities = null;
			m_paragraphTextScanner = null;
			m_wordfactory = null;
			m_wfr = null;
			m_cbaf = null;
			m_cbar = null;
			m_wordMaker = null;
			m_tssPara = null;
			m_para = null;
			m_cache = null;

			m_isDisposed = true;
		}