(self)
| 499 | |
| 500 | @property |
| 501 | def count(self): |
| 502 | # Yields the number of words in the document representation. |
| 503 | # Cache the word count so we can reuse it when calculating tf. |
| 504 | if not self._count: self._count = sum(self.terms.values()) |
| 505 | return self._count |
| 506 | |
| 507 | def __len__(self): |
| 508 | return len(self.terms) |