GetPhrase() public method

Returns a list of the words in the phrase.
public GetPhrase ( ) : Collection
return Collection
コード例 #1
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());
     }
 }
コード例 #2
0
ファイル: UnigramTagger.cs プロジェクト: abb-iss/Swum.NET
        /// <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;
                }
            }
        }
コード例 #3
0
ファイル: UnigramTagger.cs プロジェクト: abb-iss/Swum.NET
        /// <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;
                }
            }
        }
コード例 #4
0
ファイル: BaseVerbRule.cs プロジェクト: abb-iss/Swum.NET
 private bool IsPrepositionalPhrase(PhraseNode parsedName)
 {
     foreach (WordNode word in parsedName.GetPhrase())
     {
         if (word.Tag == PartOfSpeechTag.Preposition) { return true; }
     }
     return false;
 }
コード例 #5
0
ファイル: UnigramMethodRule.cs プロジェクト: abb-iss/Swum.NET
 /// <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;
 }
コード例 #6
0
ファイル: PhraseNode.cs プロジェクト: abb-iss/Swum.NET
 /// <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());
     }
 }