parses a CoNLL2009/2010 file into a multidigraph.

def _parse_conll(self, conll_filepath):
        """
        parses a CoNLL2009/2010 file into a multidigraph.
        """
        assert self.conll_format in ('2009', '2010'), \
            "We only support CoNLL2009 and CoNLL2010 format."
        if self.conll_format == '2009':
            word_class = Conll2009Word
        else:
            word_class = Conll2010Word

        def parse_conll_file(conll_file, encoding=None):
            conll_str = conll_file.read().decode(encoding) if encoding else conll_file.read()
            sentences = conll_str.strip().split("\n\n")
            for i, sentence in enumerate(sentences, 1):
                sent_id = self.__add_sentence_root_node(i)
                for word in self.__parse_conll_sentence(sentence, word_class):
                    self.__add_token(word, sent_id)
                    self.__add_dependency(word, sent_id)

        if isinstance(conll_filepath, str):
            with codecs.open(conll_filepath, 'r', 'utf-8') as conll_file:
                parse_conll_file(conll_file)
        else:  # conll_filepath is a file object (e.g. stdin)
            parse_conll_file(conll_filepath, encoding='utf-8')