code wiki / _hdl_build / _bm25_rank_authored.nx
_bm25_rank_authored.nx
buildroot/runtime/_hdl_build/_bm25_rank_authored.nx
about
AUTHORED BY THE NISHI BUILDER (bm25-rank template) -- BM25 TF relevance, bits-up integer fixed-point
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 3 | func bm25_tf_score(tf: i64, doclen: i64, avgdl: i64) -> i64 { if avgdl<=0 { return 0 } let ratio: i64=(doclen*1000)/avgdl; let denom: i64=tf*1000+300+(900*ratio)/1000; if denom<=0 { return 0 } return (tf*22000000)/denom } |
| 4 | func bm25_rank(tf0: i64, l0: i64, tf1: i64, l1: i64) -> i64 { let avgdl: i64=(l0+l1)/2; let s0: i64=bm25_tf_score(tf0,l0,avgdl); let s1: i64=bm25_tf_score(tf1,l1,avgdl); if s0>=s1 { return 0 } return 1 } |
| 5 | func main() -> i64 |