Ejemplo n.º 1
0
            protected internal override ICollection <Interval <int> > Match <_T0>(IList <_T0> nodes, int start)
            {
                PhraseTable.IWordList           words     = new PhraseTable.TokenList(nodes, textKey);
                IList <PhraseTable.PhraseMatch> matches   = phraseTable.FindMatches(words, start, nodes.Count, false);
                ICollection <Interval <int> >   intervals = new List <Interval <int> >(matches.Count);

                foreach (PhraseTable.PhraseMatch match in matches)
                {
                    intervals.Add(match.GetInterval());
                }
                return(intervals);
            }
Ejemplo n.º 2
0
        public virtual void TestFindMatches()
        {
            string      text        = "Who is Col. Jibril Rajoub";
            PhraseTable phraseTable = new PhraseTable();

            phraseTable.caseInsensitive = true;
            phraseTable.AddPhrases(phrases);
            IList <PhraseTable.PhraseMatch> matched = phraseTable.FindMatches(text, 2, 5, true);

            NUnit.Framework.Assert.IsTrue(matched != null);
            NUnit.Framework.Assert.AreEqual(2, matched.Count);
        }