-struct relevance *relevance_create(NMEM nmem, const char **terms, int numrecs)
-{
- struct relevance *res = nmem_malloc(nmem, sizeof(struct relevance));
- const char **p;
- int i;
-
- for (p = terms, i = 0; *p; p++, i++)
- ;
- res->vec_len = ++i;
- res->doc_frequency_vec = nmem_malloc(nmem, res->vec_len * sizeof(int));
- bzero(res->doc_frequency_vec, res->vec_len * sizeof(int));
- res->nmem = nmem;
- res->wt = build_word_trie(nmem, terms);
- return res;
-}
-
-void relevance_newrec(struct relevance *r, struct record *rec)
-{
- if (!rec->term_frequency_vec)
- {
- rec->term_frequency_vec = nmem_malloc(r->nmem, r->vec_len * sizeof(int));
- bzero(rec->term_frequency_vec, r->vec_len * sizeof(int));
- }
-}
-