code: def test_weighting(self, weighting, doc_en):
      result = extract.to_bag_of_terms(
          doc_en, weighting=weighting, ngs=2
      )
      assert isinstance(result, dict)
      if weighting == "freq":
          assert all(isinstance(val, float) for val in result.values())
      else:
          assert all(isinstance(val, int) for val in result.values())
  
file_path: textacy/tests/extract/test_bags.py
imports: import pytest
  import spacy
  from textacy import extract
label_desc: Use image node_id 4 for calling the TestBagOfTerms obj's underlying member method code with example usage: obj.test_weighting(weighting, doc_en) without return types