Appends the next word to the sentence / chunk / preposition. For example: Sentence.append("clawed", "claw", "VB", "VP", role=None, relation=1) - word : the current word, - lemma : the canonical form of the word, - type : part-of-speech tag
(self, word, lemma=None, type=None, chunk=None, role=None, relation=None, pnp=None, anchor=None, iob=None, custom={})
| 644 | return self.words.__iter__() |
| 645 | |
| 646 | def append(self, word, lemma=None, type=None, chunk=None, role=None, relation=None, pnp=None, anchor=None, iob=None, custom={}): |
| 647 | """ Appends the next word to the sentence / chunk / preposition. |
| 648 | For example: Sentence.append("clawed", "claw", "VB", "VP", role=None, relation=1) |
| 649 | - word : the current word, |
| 650 | - lemma : the canonical form of the word, |
| 651 | - type : part-of-speech tag for the word (NN, JJ, ...), |
| 652 | - chunk : part-of-speech tag for the chunk this word is part of (NP, VP, ...), |
| 653 | - role : the chunk's grammatical role (SBJ, OBJ, ...), |
| 654 | - relation : an id shared by other related chunks (e.g., SBJ-1 <=> VP-1), |
| 655 | - pnp : PNP if this word is in a prepositional noun phrase (B- prefix optional), |
| 656 | - iob : BEGIN if the word marks the start of a new chunk, |
| 657 | INSIDE (optional) if the word is part of the previous chunk, |
| 658 | - custom : a dictionary of (tag, value)-items for user-defined word tags. |
| 659 | """ |
| 660 | self._do_word(word, lemma, type) # Appends a new Word object. |
| 661 | self._do_chunk(chunk, role, relation, iob) # Appends a new Chunk, or adds the last word to the last chunk. |
| 662 | self._do_relation() |
| 663 | self._do_pnp(pnp, anchor) |
| 664 | self._do_anchor(anchor) |
| 665 | self._do_custom(custom) |
| 666 | self._do_conjunction() |
| 667 | |
| 668 | def parse_token(self, token, tags=[WORD, POS, CHUNK, PNP, REL, ANCHOR, LEMMA]): |
| 669 | """ Returns the arguments for Sentence.append() from a tagged token representation. |
no test coverage detected