Re:Building a full-text search engine in 150 lines of Python...
by jankovicsandras on Friday January 24, 2025 @03:17AM
(#42811420)
This is a good intro to text search.
Shameless plug:
If you throw in a bit more, ca. 250 SLOC, you can have BM25 search:
https://github.com/jankovicsandras/bm25opt
[ Parent
| on HN ]
Re:Building a full-text search engine in 150 lines of Python...
by benob on Friday January 24, 2025 @04:52AM
(#42811788)
Mine: bm25 I use for teaching (sorry for the French example)
https://gist.github.com/benob/69d48421f88f5dcc2b26a204d3251d...
Re:Building a full-text search engine in 150 lines of Python...
by heresie-dabord on Friday January 24, 2025 @07:47AM
(#42812587)
Merci! Mais faut-il s'en excuser? L'exemple est en français, voilà tout!
Re:Building a full-text search engine in 150 lines of Python...
by usrnm on Friday January 24, 2025 @09:48AM
(#42813487)
This is an English-speaking forum, so yes, it is expected to use English and link to other stuff in English (or provide a translation). It doesn't mean that French (or any other language) is a bad thing, it just isn't the language used by this community.
Re:Building a full-text search engine in 150 lines of Python...
by heresie-dabord on Friday January 24, 2025 @10:54AM
(#42814328)
Sure... but for the record, the code that the parent posted is in Python -- one of the global tech economy's pre-eminent programming languages for more than a decade. The parent's example contains some variables with Unicode values that are French words. It strikes me as odd that the parent would say sorry at all. Maybe the parent has a better understanding than I of linguistic sensitivities.
Re:Building a full-text search engine in 150 lines of Python...
by marginalia_nu on Friday January 24, 2025 @04:58AM
(#42811818)
You can probably have phrase matching in a hundred lines more, maybe less.
Most of the difficulty in search is dealing with the sheer volume of data. The algorithms themselves are pretty trivial for the most part.