Trains the classifier with the given document of the given type (i.e., class). A document can be a Document, Vector, dict, list or string. If no type is given, Document.type will be used instead.
(self, document, type=None)
| 2330 | return p[0][0] |
| 2331 | |
| 2332 | def train(self, document, type=None): |
| 2333 | """ Trains the classifier with the given document of the given type (i.e., class). |
| 2334 | A document can be a Document, Vector, dict, list or string. |
| 2335 | If no type is given, Document.type will be used instead. |
| 2336 | """ |
| 2337 | Classifier.train(self, document, type) |
| 2338 | self._model = None |
| 2339 | |
| 2340 | def classify(self, document, discrete=True): |
| 2341 | """ Returns the type with the highest probability for the given document. |