code: def test_weighted_spans_feature_union():
      doc = {
          "text": "I see: a leaning lemon tree",
          "url": "http://example.com",
      }
      vec = FeatureUnion(
          [
              (
                  "text",
                  CountVectorizer(
                      analyzer="word",
                      preprocessor=lambda x: x["text"].lower(),
                  ),
              ),
              (
                  "url",
                  CountVectorizer(
                      analyzer="char",
                      ngram_range=(4, 4),
                      preprocessor=lambda x: x["url"],
                  ),
              ),
          ]
      )
      vec.fit([doc])
      w_spans = get_weighted_spans(
          doc,
          vec,
          FeatureWeights(
              pos=[
                  FW("text__see", 2),
                  FW("text__lemon", 4),
                  FW("bias", 8),
                  FW("url__ampl", 10),
                  FW("url__mple", 7),
              ],
              neg=[
                  FW("text__tree", -6),
                  FW("url__exam", -10),
              ],
              neg_remaining=10,
          ),
      )
      assert w_spans == WeightedSpans(
          [
              DocWeightedSpans(
                  document="i see: a leaning lemon tree",
                  spans=[
                      ("see", [(2, 5)], 2),
                      ("lemon", [(17, 22)], 4),
                      ("tree", [(23, 27)], -6),
                  ],
                  preserve_density=False,
                  vec_name="text",
              ),
              DocWeightedSpans(
                  document="http://example.com",
                  spans=[
                      ("exam", [(7, 11)], -10),
                      ("ampl", [(9, 13)], 10),
                      ("mple", [(10, 14)], 7),
                  ],
                  preserve_density=True,
                  vec_name="url",
              ),
          ],
          other=FeatureWeights(
              pos=[
                  FW("bias", 8),
                  FW(
                      FormattedFeatureName(
                          "url: Highlighted in text (sum)"
                      ),
                      7,
                  ),
                  FW(
                      FormattedFeatureName(
                          "text: Highlighted in text (sum)"
                      ),
                      0,
                  ),
              ],
              neg=[],
              neg_remaining=10,
          ),
      )
  
file_path: eli5/tests/test_sklearn_text.py
imports: from sklearn.feature_extraction.text import CountVectorizer
  from sklearn.pipeline import FeatureUnion
  from eli5.base import DocWeightedSpans, WeightedSpans, FeatureWeights, FeatureWeight
  from eli5.formatters import FormattedFeatureName
  from eli5.sklearn.text import get_weighted_spans
label_desc: Use image node_id 9 for calling a global function with example usage: test_weighted_spans_feature_union() without return types