MCPcopy Index your code
hub / github.com/clips/pattern / _do_word

Method _do_word

pattern/text/tree.py:766–773  ·  view source on GitHub ↗

Adds a new Word to the sentence. Other Sentence._do_[tag] functions assume a new word has just been appended.

(self, word, lemma=None, type=None)

Source from the content-addressed store, hash-verified

764 return chunk, relation, role
765
766 def _do_word(self, word, lemma=None, type=None):
767 """ Adds a new Word to the sentence.
768 Other Sentence._do_[tag] functions assume a new word has just been appended.
769 """
770 # Improve 3rd person singular "'s" lemma to "be", e.g., as in "he's fine".
771 if lemma == "'s" and type in ("VB", "VBZ"):
772 lemma = "be"
773 self.words.append(Word(self, word, lemma, type, index=len(self.words)))
774
775 def _do_chunk(self, type, role=None, relation=None, iob=None):
776 """ Adds a new Chunk to the sentence, or adds the last word to the previous chunk.

Callers 1

appendMethod · 0.95

Calls 3

lenFunction · 0.85
WordClass · 0.70
appendMethod · 0.45

Tested by

no test coverage detected