Combine the term frequency and inverse document frequency functions to calculate the originality of a term. This 'originality' is calculated by multiplying the term frequency and the inverse document frequency : tf-idf = TF * IDF @params : tf, the term frequency, and idf
(tf: int, idf: int)
| 121 | |
| 122 | |
| 123 | def tf_idf(tf: int, idf: int) -> float: |
| 124 | """ |
| 125 | Combine the term frequency |
| 126 | and inverse document frequency functions to |
| 127 | calculate the originality of a term. This |
| 128 | 'originality' is calculated by multiplying |
| 129 | the term frequency and the inverse document |
| 130 | frequency : tf-idf = TF * IDF |
| 131 | @params : tf, the term frequency, and idf, the inverse document |
| 132 | frequency |
| 133 | @examples : |
| 134 | >>> tf_idf(2, 0.477) |
| 135 | 0.954 |
| 136 | """ |
| 137 | return round(tf * idf, 3) |
nothing calls this directly
no outgoing calls
no test coverage detected