You’re building search over a library of documents. Some words say what a document is about; others are just glue. Write importance(times_in_doc, docs_with_word, total_docs): how important one word is to one document. times_in_doc is how often this document uses the word, docs_with_word how many documents in the library use it at all, and total_docs how many documents there are.
An article about plants, in a library of 100 articles. Three of its words: how often this article says each one, and which articles in the library use it at all. Your function scores how important each word is to this article.
importance(times_in_doc, docs_with_word, total_docs)| times_in_doc | how often this document uses the word | e.g. 5 |
| docs_with_word | how many documents in the library use it | e.g. 100 |
| total_docs | how many documents the library has | e.g. 100 |
| returns | how important the word is to this document | |