def evaluate_chunker(treebank_root='corpora/treebank'): treebank = TreebankReader(treebank_root, join_clitics=True, join_verb_parts=True) chunker = Chunker() chunked_trees = list(treebank.chunked_trees()) print(chunker.evaluate(chunked_trees)) output = codecs.open('resources/chunker_errors.txt', 'w', 'utf8') for sentence, gold in zip(treebank.sents(), chunked_trees): chunked = chunker.parse(sentence) if chunked != gold: print(tree2brackets(chunked), file=output) print(tree2brackets(gold), file=output) print(file=output)
def evaluate_chunker(treebank_root='corpora/treebank'): treebank = TreebankReader(treebank_root, join_clitics=True, join_verb_parts=True) chunker = Chunker() chunked_trees = list(treebank.chunked_trees()) print(chunker.evaluate(chunked_trees)) output = codecs.open('resources/chunker_errors.txt', 'w', 'utf8') for sentence, gold in zip(treebank.sents(), chunked_trees): chunked = chunker.parse(sentence) if chunked != gold: print(tree2brackets(chunked), file=output) print(tree2brackets(gold), file=output) print(file=output)