Skip to content
Snippets Groups Projects
Select Git revision
  • 97e8c86c04ac8a9406191cd1545160c2833f77af
  • master default protected
  • vertical_relations
  • lu_without_semantic_frames
  • hierarchy
  • additional-unification-filters
  • v0.1.1
  • v0.1.0
  • v0.0.9
  • v0.0.8
  • v0.0.7
  • v0.0.6
  • v0.0.5
  • v0.0.4
  • v0.0.3
  • v0.0.2
  • v0.0.1
17 results

admin.py

Blame
  • test_wiktor_ner.py 1.28 KiB
    """Tests for WiktorNERInputParser."""
    from src.annotations import MorphosyntacticAnnotation, NerAnnotation
    from src.input_parsers.wiktor_ner import WiktorNERInputParser
    import clarin_json
    
    
    def test_wiktor_ner_input_parser():
        """Test WiktorNERInputParser."""
        parser = WiktorNERInputParser()
        with clarin_json.open('example_inputs/ner_test.jsonl', 'r') as f:
            for example_json in f:
                text, annotations = parser.parse(example_json)
    
        assert text == "Marek Kowalski pojechał do Wrocławia."
    
        assert len(annotations) == 8
    
        assert (0, 14, NerAnnotation("nam_liv_person")) in annotations
        assert (27, 36, NerAnnotation("nam_loc_gpe_city")) in annotations
    
        assert (0, 5, MorphosyntacticAnnotation("subst:sg:nom:m1", "Marek")) in annotations
        assert (
            6,
            14,
            MorphosyntacticAnnotation("subst:sg:nom:m1", "Kowalski"),
        ) in annotations
        assert (
            15,
            23,
            MorphosyntacticAnnotation("praet:sg:m1:perf", "pojechać"),
        ) in annotations
        assert (24, 26, MorphosyntacticAnnotation("prep:gen", "do")) in annotations
        assert (
            27,
            36,
            MorphosyntacticAnnotation("subst:sg:gen:m3", "Wrocław"),
        ) in annotations
        assert (36, 37, MorphosyntacticAnnotation("interp", ".")) in annotations