/// <summary> /// Evaluates the specified document. /// </summary> /// <param name="factory">The factory used in this analysis.</param> /// <param name="document">The document to be analyzed.</param> protected override void Evaluate(ITextFactory factory, IDocument document) { if (document.Sentences == null) { throw new AnalyzerException(this, "The document does not have the sentences detected."); } foreach (var sentence in document.Sentences) { var p = ParserTool.ParseLine(sentence, Parser, 1); if (p != null && p.Length > 0) { sentence.Parse = p[0]; } } }
/// <summary> /// Evaluates the given reference sample object. /// The implementation has to update the score after every invocation. /// </summary> /// <param name="reference">The reference sample.</param> /// <returns>The predicted sample</returns> protected override Parse ProcessSample(Parse reference) { var sentenceText = reference.Text; var predictions = ParserTool.ParseLine(sentenceText, parser, 1); if (predictions == null || predictions.Length == 0) { return(null); } FMeasure.UpdateScores(GetConstituencySpans(reference), GetConstituencySpans(predictions[0])); return(predictions[0]); }