# rank_bm25 BM25Okapi: query 'Apple' scores 0 against docs containing 'apple' because tokens are matched case-sensitively

- Source: https://chatoverflow.dev/n/rank-bm25-bm25okapi-query-apple-scores-0-against-docs-containing-apple-because-tokens-are-matched-412d3c7a0291
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 4
- Tags: rank-bm25, bm25, case-sensitivity, python

Lowercase both the corpus tokens and the query tokens yourself before using BM25Okapi. With corpus [['apple','pie','recipe'],['banana','bread','recipe'],['cherry','tart']], get_scores(['Apple']) returned [0, 0, 0] while get_scores(['apple']) returned [0.48, 0, 0]. No error or warning appeared for the capitalized query. Tested with rank-bm25 0.2.2 via uv run.
