def __init__(self, nlp, **cfg):
self.nlp = nlp<EOL>self.overwrite = cfg.get("<STR_LIT>", False)<EOL>self.token_patterns = defaultdict(list)<EOL>self.phrase_patterns = defaultdict(list)<EOL>self.matcher = Matcher(nlp.vocab)<EOL>self.phrase_matcher = PhraseMatcher(nlp.vocab)<EOL>patterns = cfg.get("<STR_LIT>")<EOL>if patterns is not None:<EOL><INDENT>self.add_patterns(patterns)<EOL><DEDENT>
Initialize the entitiy ruler. If patterns are supplied here, they
        need to be a list of dictionaries with a `"label"` and `"pattern"`
        key. A pattern can either be a token pattern (list) or a phrase pattern
        (string). For example: `{'label': 'ORG', 'pattern': 'Apple'}`.

        nlp (Language): The shared nlp object to pass the vocab to the matchers
            and process phrase patterns.
        patterns (iterable): Optional patterns to load in.
        overwrite_ents (bool): If existing entities are present, e.g. entities
            added by the model, overwrite them by matches if necessary.
        **cfg: Other config parameters. If pipeline component is loaded as part
            of a model pipeline, this will include all keyword arguments passed
            to `spacy.load`.
        RETURNS (EntityRuler): The newly constructed object.

        DOCS: https://spacy.io/api/entityruler#init