提交 e0e8894c 编写于 作者: C CyrusNajmabadi

Handle poorly behaved classifiers that return overlapping spans.

上级 fac8eb6d
......@@ -191,6 +191,15 @@ private static void AdjustSpans(List<ClassifiedSpan> spans, TextSpan widenedSpan
// when we walk through this list.
var intersection = span.TextSpan.Intersection(widenedSpan);
if (i > 0 && intersection != null)
{
if (spans[i - 1].TextSpan.End > intersection.Value.Start)
{
// This span isn't strictly after the previous span. Ignore it.
intersection = null;
}
}
var newSpan = new ClassifiedSpan(span.ClassificationType,
intersection ?? new TextSpan());
spans[i] = newSpan;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册