Inheritance: ITraceManager
Ejemplo n.º 1
0
 public HCParser(LcmCache cache)
 {
     m_cache           = cache;
     m_spanFactory     = new ShapeSpanFactory();
     m_traceManager    = new FwXmlTraceManager(m_cache);
     m_outputDirectory = Path.GetTempPath();
     m_changeListener  = new ParserModelChangeListener(m_cache);
     m_forceUpdate     = true;
 }
Ejemplo n.º 2
0
		public HCParser(FdoCache cache)
		{
			m_cache = cache;
			m_spanFactory = new ShapeSpanFactory();
			m_traceManager = new FwXmlTraceManager(m_cache);
			m_outputDirectory = Path.GetTempPath();
			m_changeListener = new ParserModelChangeListener(m_cache);
			m_forceUpdate = true;
		}
Ejemplo n.º 3
0
		private void MorphAndLookupWord(XmlWriter writer, Morpher morpher, string word, bool printTraceInputs, string[] selectTraceMorphs, string patrlexPath, bool doTrace)
		{
			try
			{
				ICollection<WordGrammarTrace> wordGrammarTraces = null;
				if (doTrace)
					wordGrammarTraces = new HashSet<WordGrammarTrace>();
				var traceManager = new FwXmlTraceManager(m_cache) { WriteInputs = printTraceInputs, TraceAll = doTrace };
				ICollection<WordSynthesis> synthesisRecs = morpher.MorphAndLookupWord(word, traceManager, selectTraceMorphs);

				IEnumerable<PatrResult> patrResults = ProcessPatr(synthesisRecs, patrlexPath, doTrace);
				foreach (PatrResult patrResult in patrResults)
				{
					if (patrResult.PassedPatr)
						BuildXmlOutput(writer, patrResult.Morphs);
					if (wordGrammarTraces != null)
						wordGrammarTraces.Add(patrResult.WordGrammarTrace);
				}

				if (doTrace)
				{
					WriteTrace(writer, traceManager);
					ConvertWordGrammarTraceToXml(writer, wordGrammarTraces);
				}
				traceManager.Reset();
			}
			catch (MorphException exc)
			{
				Write(writer, exc);
			}
		}