class_docstr: Test document retrieval functions in the `text_analytics` toolkit.
class_docstr_tok: ["Test","document","retrieval","functions","in","the","`","text_analytics","`","toolkit","."]
docstr: Check correctness of the BM2.5 query.
docstr_tok: ["Check","correctness","of","the","BM2.5","query","."]
code: def test_bm25(self):
      """
      Check correctness of the BM2.5 query.
      """
  
      # Test input formats
      query = ["a", "b", "c"]
      assert text_analytics.bm25(self.data, query) is not None
  
      query = tc.SArray(["a", "b", "c"])
      assert text_analytics.bm25(self.data, query) is not None
  
      query = {"a": 5, "b": 3, "c": 1}
      assert text_analytics.bm25(self.data, query) is not None
  
      # Only documents containing query words are included in result
      assert text_analytics.bm25(self.data, query).num_rows() == 4
  
      dataset = tc.SArray(
          [
              {"a": 5, "b": 7, "c": 10},
              {"a": 3, "c": 1, "d": 2},
              None,
              {"a": 1},
              {"f": 5},
          ]
      )
  
      res = text_analytics.bm25(dataset, query)
      assert res.num_rows() == 3
  
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import math
  import unittest
  import warnings
  import turicreate
  import turicreate.toolkits.text_analytics
  from .None import util
label_desc: Use image node_id 2 for calling the RetrievalTest obj's underlying member method code with example usage: obj.test_bm25() without return types