code: def test_entity_match_factory(self):
      # Given
      dataset_stream = io.StringIO(
          """
  ---
  type: intent
  name: my_intent
  utterances:
  - this is [entity1](my first entity)
  - this is [entity2](second_entity)"""
      )
  
      dataset = Dataset.from_yaml_files("en", [dataset_stream]).json
  
      config = {
          "factory_name": "entity_match",
          "args": {
              "tagging_scheme_code": TaggingScheme.BILOU.value,
              "use_stemming": True,
          },
          "offsets": [0],
      }
  
      tokens = tokenize(
          "my first entity and second_entity and third_entity",
          LANGUAGE_EN,
      )
      cache = [{TOKEN_NAME: token} for token in tokens]
      resources = {STEMS: dict()}
      custom_entity_parser = CustomEntityParser.build(
          dataset, CustomEntityParserUsage.WITH_STEMS, resources
      )
      factory = CRFFeatureFactory.from_config(
          config,
          custom_entity_parser=custom_entity_parser,
          resources=resources,
      )
      factory.fit(dataset, "my_intent")
  
      # When
      features = factory.build_features()
      features = sorted(features, key=lambda f: f.base_name)
      res0 = features[0].compute(0, cache)
      res1 = features[0].compute(1, cache)
      res2 = features[0].compute(2, cache)
      res3 = features[0].compute(3, cache)
      res4 = features[0].compute(4, cache)
  
      res5 = features[1].compute(0, cache)
      res6 = features[1].compute(1, cache)
      res7 = features[1].compute(2, cache)
      res8 = features[1].compute(3, cache)
      res9 = features[1].compute(4, cache)
  
      # Then
      self.assertIsInstance(factory, CustomEntityMatchFactory)
      self.assertEqual(len(features), 2)
      self.assertEqual(features[0].base_name, "entity_match_entity1")
      self.assertEqual(features[1].base_name, "entity_match_entity2")
      self.assertEqual(res0, BEGINNING_PREFIX)
      self.assertEqual(res1, INSIDE_PREFIX)
      self.assertEqual(res2, LAST_PREFIX)
      self.assertEqual(res3, None)
      self.assertEqual(res4, None)
  
      self.assertEqual(res5, None)
      self.assertEqual(res6, None)
      self.assertEqual(res7, None)
      self.assertEqual(res8, None)
      self.assertEqual(res9, UNIT_PREFIX)
  
imports: from __future__ import unicode_literals
  import io
  from mock import MagicMock
  from snips_nlu.constants import LANGUAGE, LANGUAGE_EN, SNIPS_DATETIME, SNIPS_NUMBER, STEMS, GAZETTEERS, WORD_CLUSTERS
  from snips_nlu.dataset import Dataset
  from snips_nlu.entity_parser import BuiltinEntityParser, CustomEntityParser
  from snips_nlu.entity_parser.custom_entity_parser_usage import CustomEntityParserUsage
  from snips_nlu.exceptions import NotRegisteredError
  from snips_nlu.preprocessing import tokenize
  from snips_nlu.slot_filler.crf_utils import BEGINNING_PREFIX, INSIDE_PREFIX, LAST_PREFIX, TaggingScheme, UNIT_PREFIX
  from snips_nlu.slot_filler.feature import Feature, TOKEN_NAME
  from snips_nlu.slot_filler.feature_factory import BuiltinEntityMatchFactory, CustomEntityMatchFactory, IsDigitFactory, IsFirstFactory, IsLastFactory, LengthFactory, NgramFactory, PrefixFactory, ShapeNgramFactory, SingleFeatureFactory, SuffixFactory, WordClusterFactory, CRFFeatureFactory
  from snips_nlu.tests.utils import SnipsTest
label_desc: Use image node_id 16 for calling the TestCRFFeatures obj's underlying member method code with example usage: obj.test_entity_match_factory() without return types