def add_patterns(self, patterns):
for entry in patterns:<EOL><INDENT>label = entry["<STR_LIT:label>"]<EOL>pattern = entry["<STR_LIT>"]<EOL>if isinstance(pattern, basestring_):<EOL><INDENT>self.phrase_patterns[label].append(self.nlp(pattern))<EOL><DEDENT>elif isinstance(pattern, list):<EOL><INDENT>self.token_patterns[label].append(pattern)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(Errors.E097.format(pattern=pattern))<EOL><DEDENT><DEDENT>for label, patterns in self.token_patterns.items():<EOL><INDENT>self.matcher.add(label, None, *patterns)<EOL><DEDENT>for label, patterns in self.phrase_patterns.items():<EOL><INDENT>self.phrase_matcher.add(label, None, *patterns)<EOL><DEDENT>
Add patterns to the entitiy ruler. A pattern can either be a token
        pattern (list of dicts) or a phrase pattern (string). For example:
        {'label': 'ORG', 'pattern': 'Apple'}
        {'label': 'GPE', 'pattern': [{'lower': 'san'}, {'lower': 'francisco'}]}

        patterns (list): The patterns to add.

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