@@ -0,0 +1,2428 @@
+# Be able to call directly such as %60python test_annotators.py%60%0Atry:%0A    from .context import loctext%0Aexcept SystemError:  # Parent module '' not loaded, cannot perform relative import%0A    pass%0A%0Afrom pytest import raises%0Afrom loctext.util import PRO_ID, LOC_ID, REL_PRO_LOC_ID, repo_path, UNIPROT_NORM_ID, GO_NORM_ID%0Afrom loctext.learning.evaluations import relation_equals_uniprot_go, GO_TREE%0Afrom nalaf import print_verbose, print_debug%0Afrom nalaf.learning.evaluators import DocumentLevelRelationEvaluator, Evaluations%0Afrom nalaf.learning.taggers import StubRelationExtractor%0Afrom loctext.learning.train import read_corpus, evaluate_with_argv%0Afrom nalaf import print_verbose, print_debug%0Afrom nalaf.preprocessing.edges import SentenceDistanceEdgeGenerator%0Aimport math%0Aimport sys%0A%0A%0Adef test_same_stats():%0A%0A    original = read_corpus(%22LocText_original%22, corpus_percentage=1.0)%0A    newone = read_corpus(%22LocText%22, corpus_percentage=1.0)%0A%0A    # Verification%0A    original.validate_annotation_offsets()%0A    newone.validate_annotation_offsets()%0A%0A    # Basic%0A    assert 100 == len(original) == len(newone)%0A    assert len(list(original.entities())) == len(list(newone.entities())) and len(list(original.entities())) %3E 0%0A    assert 0 == len(list(original.predicted_entities())) == len(list(newone.predicted_entities()))%0A    assert len(list(original.relations())) == len(list(newone.relations())) and len(list(original.relations())) %3E 0%0A    assert 0 == len(list(original.predicted_relations())) == len(list(newone.predicted_relations()))%0A%0A    # Elaborated%0A    edge_generator_d0 = SentenceDistanceEdgeGenerator(PRO_ID, LOC_ID, REL_PRO_LOC_ID, distance=0)%0A    annotator = StubRelationExtractor(edge_generator_d0)%0A%0A    annotator.annotate(original)%0A    annotator.annotate(newone)%0A%0A    assert len(list(original.edges())) %3E 0 and (len(list(original.edges())) == len(list(newone.edges())) == len(list(newone.predicted_relations())))%0A    num_d0 = len(list(newone.predicted_relations()))%0A%0A    edge_generator_d1 = SentenceDistanceEdgeGenerator(PRO_ID, LOC_ID, REL_PRO_LOC_ID, distance=1)%0A    annotator = StubRelationExtractor(edge_generator_d1)%0A%0A    annotator.annotate(original)%0A    annotator.annotate(newone)%0A%0A    assert len(list(original.edges())) %3E 0 and (len(list(original.edges())) == len(list(newone.edges())) == (- num_d0 + len(list(newone.predicted_relations()))))%0A%0A%0Aif __name__ == %22__main__%22:%0A%0A    # selected tests:%0A%0A    test_same_stats()%0A

test conversion of #2