code: def _make_pattern_from_string(patstr: str) -> list[dict[str, str]]:
      pattern = []
      for tokpatstr in constants.RE_MATCHER_TOKPAT_DELIM.split(patstr):
          parts = tokpatstr.split(":")
          if 2 <= len(parts) <= 3:
              attr = parts[0]
              attr_val = parts[1]
              if attr and attr_val:
                  # handle special bool and int attribute values
                  special_val = constants.RE_MATCHER_SPECIAL_VAL.match(
                      attr_val
                  )
                  if special_val:
                      attr_val = eval(special_val.group(0))
                  tokpat = {attr: attr_val}
              # handle wildcard tokens
              else:
                  tokpat = {}
              # handle quantifier ops
              try:
                  op_val = parts[2]
                  if op_val in constants.MATCHER_VALID_OPS:
                      tokpat["OP"] = op_val
                  else:
                      raise ValueError(
                          errors.value_invalid_msg(
                              "op", op_val, constants.MATCHER_VALID_OPS
                          )
                      )
              except IndexError:
                  pass
              pattern.append(tokpat)
          else:
              raise ValueError(
                  f"pattern string '{patstr}' is invalid; "
                  "each element in a pattern string must contain an attribute, "
                  "a corresponding value, and an optional quantity qualifier, "
                  "delimited by colons, like attr:value:op"
              )
      return pattern
  
file_path: textacy/src/textacy/extract/matches.py
imports: from __future__ import annotations
  import re
  from typing import Callable, Iterable, Literal, Optional, Pattern, Union
  from spacy.matcher import Matcher
  from spacy.tokens import Span
  from ..None import constants, errors, types
label_desc: Use image node_id 2 for calling a global function with example usage: _make_pattern_from_string(patstr) and returns: pattern