public static void VerifyAnalysis(ISegment seg, int iSeg,
IEnumerable<int> expectedFormsWithoutAnalyses, IEnumerable<int> expectedWordforms)
{
string baseline = seg.BaselineText.Text;
if (seg.IsLabel)
{
// We don't really care about analyses in label segments, but if we do have one, it better
// be a punctuation form that exactly matches the segment's baseline.
Assert.IsTrue(seg.AnalysesRS.Count == 0 ||
(seg.AnalysesRS.Count == 1 && ((IPunctuationForm)seg.AnalysesRS[0]).Form.Text == baseline));
return;
}
int cAnalysis = ParseSegBaseline(seg, seg.BeginOffset, seg.EndOffset,
(iForm, word, iAnalysis) => VerifyWfi(seg, iForm, word, iAnalysis, expectedFormsWithoutAnalyses, expectedWordforms),
(puncForm, iAnalysis) => VerifyPunctuationForm(seg, puncForm, iAnalysis),
(ich, iAnalysis) =>
{
ITsString form = VerifyPunctuationForm(seg, StringUtils.kszObject, iAnalysis);
FwObjDataTypes odt, odtExpected;
TsRunInfo tri;
ITsTextProps ttp;
Guid guid = TsStringUtils.GetGuidFromRun(form, 0, out odt, out tri, out ttp, null);
Assert.AreEqual(TsStringUtils.GetGuidFromProps(
seg.BaselineText.get_PropertiesAt(ich), null, out odtExpected), guid);
Assert.AreEqual(odtExpected, odt);
});
Assert.AreEqual(cAnalysis, seg.AnalysesRS.Count, "Segment " + iSeg + " (" +
seg.BaselineText.Text + ") had too many analyses");
}