def annotateText(self, text, layer, np_labels = None):
        ''' Applies this chunker on given Text, and adds results of 
            the chunking as a new annotation layer to the text.
            If the NP annotations are provided (via the input list 
            *np_labels*), uses the given NP annotations, otherwise 
            produces new NP_LABEL annotations via the method 
            self.analyze_text();
            
            Parameters
            ----------
            text:  estnltk.text.Text
                The input text where the new layer of NP chunking 
                annotations is to be added;
            layer: str
                Name of the new layer;
            np_labels : list of str
                Optional: A list of strings, containing a B-I-O label 
                for each word in *text*; If provided, uses annotations
                from *np_labels*, otherwise creates new annotations 
                with this chunker;
                
            Returns
            -------
            text
                The input text where a new layer (containing NP 
                annotations) has been added;
        ''' 
        input_words = None
        if isinstance(text, Text):
            # input is Text
            input_words = text.words
        else:
            raise Exception(' Input text should be of type Text, but it is ', text)
        phrases = []
        #  If NP_LABEL-s are not provided, text needs to be analyzed first:
        if not np_labels:
            np_labels = self.analyze_text( text, return_type="labels" )
        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)))
        #  Fetch NP chunks
        phrases = self.get_phrases( text, np_labels )
        # Create and attach annotations to the Text object
        annotations = []
        if phrases:
            for phrase in phrases: 
                phrase_annotation = {}
                phrase_annotation[START] = phrase[0][START]
                phrase_annotation[END]   = phrase[-1][END]
                phrase_annotation[TEXT]  = ' '.join([word[TEXT] for word in phrase ])
                annotations.append( phrase_annotation )
        text[layer] = annotations
        return text