private NlpAnalysis AnalyseText(NlpQuery query) { var analysis = new NlpAnalysis(); if (IsInitialized) { var text = query.Text; var annotation = new Annotation(text); m_pipeline.annotate(annotation); var sentences = annotation.get(typeof(CoreAnnotations.SentencesAnnotation)) as ArrayList; if (sentences != null) { analysis.Sentences = sentences; } } return(analysis); }
public NlpAnalysis AnalyseText(string queryText) { var analysis = new NlpAnalysis(); if (IsInitialized) { var query = new NlpQuery(queryText); m_requestQueue.Enqueue(query); m_waitEvent.WaitOne(); if (!m_responseBucket.TryRemove(query.Id, out analysis)) { throw new Exception("Could not remove analysis from the bucket."); } } else { throw new InvalidOperationException("NlpEngineThread not yet initialized"); } return(analysis); }