docs: def get_phrases(self, text, np_labels):
          ''' Given a Text and a BIO labels (one label for each word in Text) , 
              extracts phrases and returns as a list of phrases, where each phrase 
              is a list of word tokens belonging to the phrase;
              
              Parameters
              ----------
              text:  estnltk.text.Text
                  The input Text, or a list consecutive words (dict objects).
                  The method attempts to automatically determine the type of 
                  the input;
                  
              np_labels : list of str
                  A list of strings, containing a B-I-O label for each word in 
                  *text*;
                  
              Returns
              -------
              list of (list of tokens)
                  List of phrases, where each phrase is a list of word tokens 
                  belonging to the phrase;
          '''
          # 1) Take different inputs to common list of words format:
          input_words = []
          if isinstance(text, Text):
              # input is Text
              input_words = text.words
          elif isinstance(text, list) and len(text)>0 and isinstance(text[0], dict) and \
               TEXT in text[0]:
              # input is a list of words
              input_words = text
          elif text:
              raise Exception('Unexpected input text:', text)
          if len(input_words) != len(np_labels):
              raise Exception(' (!) Number of words ('+str(len(input_words))+\
                              ') does not match number of labels '+str(len(np_labels)))
  
          # 2) Extract phrases from input words:
          phrases = []
          for i, word in enumerate(input_words):
              label = np_labels[i]
              if label == 'B':
                  phrases.append([])
              if label in ['B', 'I']:
                  phrases[-1].append( word )
          return phrases