Embed a list of n documents/words into an n-dimensional matrix of embeddings. Arguments: documents: A list of documents or words to be embedded verbose: No-op variable that's kept around to keep the API consistent. If you want to get feedback on training time
(self, documents, verbose=False)
| 48 | self.pipe = pipe |
| 49 | |
| 50 | def embed(self, documents, verbose=False): |
| 51 | """Embed a list of n documents/words into an n-dimensional |
| 52 | matrix of embeddings. |
| 53 | |
| 54 | Arguments: |
| 55 | documents: A list of documents or words to be embedded |
| 56 | verbose: No-op variable that's kept around to keep the API consistent. If you want to get feedback on training times, you should use the sklearn API. |
| 57 | |
| 58 | Returns: |
| 59 | Document/words embeddings with shape (n, m) with `n` documents/words |
| 60 | that each have an embeddings size of `m` |
| 61 | """ |
| 62 | try: |
| 63 | check_is_fitted(self.pipe) |
| 64 | embeddings = self.pipe.transform(documents) |
| 65 | except NotFittedError: |
| 66 | embeddings = self.pipe.fit_transform(documents) |
| 67 | |
| 68 | return embeddings |
nothing calls this directly
no test coverage detected