Exemple #1
0
            internal override string Extract(History h, PairsHolder pH)
            {
                StringBuilder sb = new StringBuilder();

                if (position < 0)
                {
                    for (int idx = position; idx < 0; idx++)
                    {
                        if (idx != position)
                        {
                            sb.Append('!');
                        }
                        sb.Append(pH.GetTag(h, idx));
                    }
                }
                else
                {
                    for (int idx = position; idx > 0; idx--)
                    {
                        if (idx != position)
                        {
                            sb.Append('!');
                        }
                        sb.Append(pH.GetTag(h, idx));
                    }
                }
                return(sb.ToString());
            }
Exemple #2
0
 internal override string Extract(History h, PairsHolder pH)
 {
     // I ran a bunch of timing tests that seem to indicate it is
     // cheaper to simply add string + char + string than use a
     // StringBuilder or go through the StringBuildMemoizer -horatio
     return(pH.GetTag(h, leftPosition) + '!' + pH.GetTag(h, rightPosition));
 }
Exemple #3
0
 public virtual void PrintSent()
 {
     Print(System.Console.Out);
     for (int i = this.start; i < this.end; i++)
     {
         System.Console.Out.Write(pairs.GetTag(i) + ' ' + pairs.GetWord(i) + '\t');
     }
     System.Console.Out.WriteLine();
 }
Exemple #4
0
        internal virtual string ExtractLV(History h, PairsHolder pH, int bound)
        {
            // should extract last verbal word and also the current word
            int    start    = h.start;
            string lastverb = "NA";
            int    current  = h.current;
            int    index    = current - 1;

            while ((index >= start) && (index >= current - bound))
            {
                string tag = pH.GetTag(index);
                if (tag.StartsWith("VB"))
                {
                    lastverb = pH.GetWord(index);
                    break;
                }
                if (tag.StartsWith(","))
                {
                    break;
                }
                index--;
            }
            return(lastverb);
        }
Exemple #5
0
 internal virtual string Extract(History h, PairsHolder pH)
 {
     return(isTag ? pH.GetTag(h, position) : pH.GetWord(h, position));
 }
Exemple #6
0
 internal override string Extract(History h, PairsHolder pH)
 {
     return(pH.GetTag(h, position1) + '!' + pH.GetWord(h, word) + '!' + pH.GetTag(h, position2));
 }
Exemple #7
0
 internal override string Extract(History h, PairsHolder pH)
 {
     return(pH.GetWord(h, leftWord) + '!' + pH.GetTag(h, tag) + '!' + pH.GetWord(h, rightWord));
 }