GetPhrase() public method

Returns a list of the words in the phrase.
public GetPhrase ( ) : Collection
return Collection
 /// <summary>
 /// Concatenates the supplied phrase to the end of the current phrase.
 /// </summary>
 /// <param name="phrase">The phrase to add.</param>
 public void Add(PhraseNode phrase)
 {
     if (phrase != null)
     {
         Words.AddRange(phrase.GetPhrase());
     }
 }
Example #2
0
        /// <summary>
        /// Tags any word nodes in the given phrase that are prepositions.
        /// </summary>
        /// <param name="phrase">The phrase to tag.</param>
        public void TagPrepostions(PhraseNode phrase)
        {
            if (phrase == null) { return; }

            foreach (var word in phrase.GetPhrase())
            {
                if (pos.IsPreposition(word.Text))
                {
                    word.Tag = PartOfSpeechTag.Preposition;
                }
            }
        }
Example #3
0
        /// <summary>
        /// Tags any word nodes in the given phrase that contain digits.
        /// </summary>
        /// <param name="phrase">The phrase to tag.</param>
        public void TagDigits(PhraseNode phrase)
        {
            if (phrase == null) { return; }

            foreach (var word in phrase.GetPhrase())
            {
                if(Regex.IsMatch(word.Text, @"\d+"))
                {
                    word.Tag = PartOfSpeechTag.Digit;
                }
            }
        }
Example #4
0
 private bool IsPrepositionalPhrase(PhraseNode parsedName)
 {
     foreach (WordNode word in parsedName.GetPhrase())
     {
         if (word.Tag == PartOfSpeechTag.Preposition) { return true; }
     }
     return false;
 }
Example #5
0
 /// <summary>
 /// Finds all the verbs in the given name and adds them to the given preamble.
 /// </summary>
 /// <param name="parsedName">The PhraseNode to gets the verbs from.</param>
 /// <param name="preamble">The preamble PhraseNode to add the verbs to.</param>
 /// <returns>The preamble PhraseNode with the verbs added.</returns>
 private PhraseNode GetVerbPhrase(PhraseNode parsedName, PhraseNode preamble)
 {
     //TODO: should this make a copy of the preamble first?
     PhraseNode phrase = preamble;
     foreach (WordNode word in parsedName.GetPhrase())
     {
         if (word.Tag == PartOfSpeechTag.Verb
             || word.Tag == PartOfSpeechTag.VerbModifier
             || word.Tag == PartOfSpeechTag.VerbParticle
             || word.Tag == PartOfSpeechTag.NonVerb
             || word.Tag == PartOfSpeechTag.VerbIgnorable)
         {
             phrase.Add(word);
         }
     }
     return phrase;
 }
Example #6
0
 /// <summary>
 /// Concatenates the supplied phrase to the end of the current phrase.
 /// </summary>
 /// <param name="phrase">The phrase to add.</param>
 public void Add(PhraseNode phrase) {
     if(phrase != null) {
         Words.AddRange(phrase.GetPhrase());
     }
 }