Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParseFiler"/> class.
        /// </summary>
        /// <param name="cache">The cache.</param>
        /// <param name="taskUpdateHandler">The task update handler.</param>
        /// <param name="idleQueue">The idle queue.</param>
        /// <param name="parserAgent">The parser agent.</param>
        public ParseFiler(FdoCache cache, Action <TaskReport> taskUpdateHandler, IdleQueue idleQueue, ICmAgent parserAgent)
        {
            Debug.Assert(cache != null);
            Debug.Assert(taskUpdateHandler != null);
            Debug.Assert(idleQueue != null);
            Debug.Assert(parserAgent != null);

            m_cache             = cache;
            m_taskUpdateHandler = taskUpdateHandler;
            m_idleQueue         = idleQueue;
            m_parserAgent       = parserAgent;
            m_resultQueue       = new Queue <ParseResult>();
            m_syncRoot          = new object();

            var servLoc = cache.ServiceLocator;

            m_wordformRepository       = servLoc.GetInstance <IWfiWordformRepository>();
            m_analysisFactory          = servLoc.GetInstance <IWfiAnalysisFactory>();
            m_mbFactory                = servLoc.GetInstance <IWfiMorphBundleFactory>();
            m_baseAnnotationRepository = servLoc.GetInstance <ICmBaseAnnotationRepository>();
            m_baseAnnotationFactory    = servLoc.GetInstance <ICmBaseAnnotationFactory>();
            m_moFormRepository         = servLoc.GetInstance <IMoFormRepository>();
            m_msaRepository            = servLoc.GetInstance <IMoMorphSynAnalysisRepository>();
            m_userAgent                = m_cache.LanguageProject.DefaultUserAgent;

            m_analysesWithOldEvaluation = new HashSet <IWfiAnalysis>(
                m_cache.ServiceLocator.GetInstance <IWfiAnalysisRepository>().AllInstances().Where(
                    analysis => analysis.GetAgentOpinion(m_parserAgent) != Opinions.noopinion));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ParseFiler"/> class.
        /// </summary>
        /// <param name="cache">The cache.</param>
        /// <param name="taskUpdateHandler">The task update handler.</param>
        /// <param name="idleQueue">The idle queue.</param>
        /// <param name="parserAgent">The parser agent.</param>
        public ParseFiler(LcmCache cache, Action <TaskReport> taskUpdateHandler, IdleQueue idleQueue, ICmAgent parserAgent)
        {
            Debug.Assert(cache != null);
            Debug.Assert(taskUpdateHandler != null);
            Debug.Assert(idleQueue != null);
            Debug.Assert(parserAgent != null);

            m_cache             = cache;
            m_taskUpdateHandler = taskUpdateHandler;
            m_idleQueue         = idleQueue;
            m_parserAgent       = parserAgent;
            m_workQueue         = new Queue <WordformUpdateWork>();
            m_syncRoot          = new object();

            ILcmServiceLocator servLoc = cache.ServiceLocator;

            m_analysisFactory          = servLoc.GetInstance <IWfiAnalysisFactory>();
            m_mbFactory                = servLoc.GetInstance <IWfiMorphBundleFactory>();
            m_baseAnnotationRepository = servLoc.GetInstance <ICmBaseAnnotationRepository>();
            m_baseAnnotationFactory    = servLoc.GetInstance <ICmBaseAnnotationFactory>();
            m_userAgent                = m_cache.LanguageProject.DefaultUserAgent;
        }
Ejemplo n.º 3
0
		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>();
		}
Ejemplo n.º 4
0
		/// <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;
		}
Ejemplo n.º 5
0
		/// <summary>
		/// Initializes a new instance of the <see cref="ParseFiler"/> class.
		/// </summary>
		/// <param name="cache">The cache.</param>
		/// <param name="taskUpdateHandler">The task update handler.</param>
		/// <param name="idleQueue">The idle queue.</param>
		/// <param name="parserAgent">The parser agent.</param>
		public ParseFiler(FdoCache cache, Action<TaskReport> taskUpdateHandler, IdleQueue idleQueue, ICmAgent parserAgent)
		{
			Debug.Assert(cache != null);
			Debug.Assert(taskUpdateHandler != null);
			Debug.Assert(idleQueue != null);
			Debug.Assert(parserAgent != null);

			m_cache = cache;
			m_taskUpdateHandler = taskUpdateHandler;
			m_idleQueue = idleQueue;
			m_parserAgent = parserAgent;
			m_workQueue = new Queue<WordformUpdateWork>();
			m_syncRoot = new object();

			IFdoServiceLocator servLoc = cache.ServiceLocator;
			m_analysisFactory = servLoc.GetInstance<IWfiAnalysisFactory>();
			m_mbFactory = servLoc.GetInstance<IWfiMorphBundleFactory>();
			m_baseAnnotationRepository = servLoc.GetInstance<ICmBaseAnnotationRepository>();
			m_baseAnnotationFactory = servLoc.GetInstance<ICmBaseAnnotationFactory>();
			m_userAgent = m_cache.LanguageProject.DefaultUserAgent;
		}