class_docstr: A spaCy pipe for detecting hyponyms using Hearst patterns.
  This class sets the following attributes:
  
  - `Doc._.hearst_patterns`: A List[Tuple[str, Span, Span]] corresonding to
     the matching predicate, extracted general term and specific term
     that matched a Hearst pattern.
  
  Parts of the implementation taken from
  https://github.com/mmichelsonIF/hearst_patterns_python/blob/master/hearstPatterns/hearstPatterns.py
  and
  https://github.com/Fourthought/CNDPipeline/blob/master/cndlib/hpspacy.py
  
  The pipe can be used with an instantiated spacy model like so:
  ```
  # add the hyponym detector
  nlp.add_pipe('hyponym_detector', config={'extended': True}, last=True)
  
  Parameters
  ----------
  
  nlp: `Language`, a required argument for spacy to use this as a factory
  name: `str`, a required argument for spacy to use this as a factory
  extended: `bool`, whether to use the extended Hearts patterns or not
code: def find_noun_compound_head(self, token: Token):
      while (
          token.head.pos_ in {"PROPN", "NOUN", "PRON"}
          and token.dep_ == "compound"
      ):
          token = token.head
      return token
  
file_path: scispacy/scispacy/hyponym_detector.py
imports: from spacy.matcher import Matcher
  from spacy.tokens import Token, Doc
  from spacy.language import Language
  from scispacy.hearst_patterns import BASE_PATTERNS, EXTENDED_PATTERNS
label_desc: Use image node_id 3 for calling the HyponymDetector obj's underlying member method code with example usage: obj.find_noun_compound_head(token) and returns: token