Appends the given Document to the model. If Model.weight != TF, the cache of vectors and cosine similarity is cleared (feature weights will be different now that there is a new document).
(self, document)
| 901 | self._update() |
| 902 | |
| 903 | def append(self, document): |
| 904 | """ Appends the given Document to the model. |
| 905 | If Model.weight != TF, the cache of vectors and cosine similarity is cleared |
| 906 | (feature weights will be different now that there is a new document). |
| 907 | """ |
| 908 | if not isinstance(document, Document): |
| 909 | raise TypeError, "Model.append() expects a Document." |
| 910 | document._model = self |
| 911 | if document.name is not None: |
| 912 | self._index[document.name] = document |
| 913 | if self._weight != TF: |
| 914 | self._update() |
| 915 | list.append(self.documents, document) |
| 916 | |
| 917 | def extend(self, documents): |
| 918 | """ Extends the model with the given list of documents. |
no test coverage detected