from defender.defender import Defender
import os
import corpus2
__author__ = 'blaz'


class TestClass:
    def test_defender_logic(self):
        defender = Defender(
            '../resources/dictionaries/dict-syn-mpar.lex',
            '../resources/dictionaries/dict-gerundium.lex',
            '../resources/dictionaries/dict-pred-snd-type.lex',
        )
        test_file_path = \
            os.path.join('test_data','test_ccl.xml').encode('utf-8')
        tagset = corpus2.get_named_tagset('nkjp')
        reader = corpus2.CclRelReader(tagset, test_file_path, test_file_path)
        doc = reader.read()
        np = defender.read_document_np_phrases_relations(doc)
        adjp = defender.read_document_adjp_phrases_relations(doc)
        agp = defender.read_document_agp_phrases_relations(doc)
        assert len(np) and len(adjp) and len(agp), 'Something is wrong'