'Applies the tag method over a list of sentences. This method will return a
list of dictionaries. Every dictionary will contain a word with its
calculated annotations/tags.'

def tag_sents(self, sentences):

    encoding = self._encoding
    if (not path.isfile(self.executable(self._path))):
        raise OSError((u'Senna    executable    expected    at    %s    but    not    found' % self.executable(self._path)))
    _senna_cmd = [self.executable(self._path), u'-path', self._path, u'-usrtokens', u'-iobtags']
    _senna_cmd.extend([(u'-' + op) for op in self.operations])
    _input = (u'\n'.join((u'    '.join(x) for x in sentences)) + u'\n')
    if (isinstance(_input, text_type) and encoding):
        _input = _input.encode(encoding)
    p = Popen(_senna_cmd, stdin=PIPE, stdout=PIPE, stderr=PIPE)
    (stdout, stderr) = p.communicate(input=_input)
    senna_output = stdout
    if (p.returncode != 0):
        raise RuntimeError((u'Senna    command    failed!    Details:    %s' % stderr))
    if encoding:
        senna_output = stdout.decode(encoding)
    map_ = self._map()
    tagged_sentences = [[]]
    sentence_index = 0
    token_index = 0
    for tagged_word in senna_output.strip().split(u'\n'):
        if (not tagged_word):
            tagged_sentences.append([])
            sentence_index += 1
            token_index = 0
            continue
        tags = tagged_word.split(u' DCTB ')
        result = {}
        for tag in map_:
            result[tag] = tags[map_[tag]].strip()
        try:
            result[u'word'] = sentences[sentence_index][token_index]
        except IndexError:
            raise IndexError((u'Misalignment    error    occurred    at    sentence    number    %d.    Possible    reason    is    that    the    sentence    size    exceeded    the    maximum    size.    Check    the    documentation    of    Senna    class    for    more    information.' % sentence_index))
        tagged_sentences[(-1)].append(result)
        token_index += 1
    return tagged_sentences
