+ w[res] += local_weight / (1 + log2(1 + lead_decay * length));
+ wrbuf_printf(wr, "%s: w[%d] += w(%d) / "
+ "(1+log2(1+lead_decay(%f) * length(%d)));\n",
+ e->display_str, res, local_weight, lead_decay, length);
+ j = res - 1;
+ if (j > 0 && r->term_pos[j])
+ {
+ int d = length + 1 - r->term_pos[j];
+ wrbuf_printf(wr, "%s: w[%d] += w[%d](%d) * follow(%f) / "
+ "(1+log2(d(%d));\n",
+ e->display_str, res, res, w[res],
+ r->follow_factor, d);
+ w[res] += w[res] * r->follow_factor / (1 + log2(d));
+ }
+ for (j = 0; j < r->vec_len; j++)
+ r->term_pos[j] = j < res ? 0 : length + 1;