本文整理汇总了C#中Annotation类的典型用法代码示例。如果您正苦于以下问题:C#Annotation类的具体用法?C#Annotation怎么用?C#Annotation使用的例子?这里精选的类代码示例或许可以为您提供帮助。
示例1:Analyze
///
///ExecutesSentimentandEntitiesMentionedanalysis.
///
publicIOutcome
Analyze(StanfordCoreNLPpipeline,stringtext)
{
//Createannotateddocument
Annotationdoc=newAnnotation(text);
pipeline.annotate(doc);
//Validate
varsentences=doc.get(typeof(CoreAnnotations.SentencesAnnotation));
if(sentences==null)
returnOutcomes.Outcomes
.Failure()
.WithMessage("Nosentencesdetected.");
//Analyze
varresult=newAnalysisResult()
{
Sentiment=GetSentiment((ArrayList)sentences),
MentionedEntities=GetMentions(doc)
};
returnOutcomes.Outcomes
.Success()
.WithValue(result);
}
原文链接:http://www.jxszl.com/biancheng/C/556539.html