This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Goals: | |
Easy to learn and use by beginning programmers | |
Easy to relearn and use by "perpetual intermediate" programmers | |
Suitable for use as a front-end language (not in a browser) | |
Not infuriating to advanced programmers | |
Case insensitive (except strings) | |
Everything should be as simple as possible but no simpler | |
High-level design choices: | |
Mostly intended for easy UI programming |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BM25F Model | |
def bm25(idf, tf, fl, avgfl, B, K1): | |
# idf - inverse document frequency | |
# tf - term frequency in the current document | |
# fl - field length in the current document | |
# avgfl - average field length across documents in collection | |
# B, K1 - free paramters | |
return idf * ((tf * (K1 + 1)) / (tf + K1 * (1 - B + B * (fl / avgfl)))) |