コード例 #1
0
 def setUp(self):
     levin_class = LevinClass(number=4, name='Imaginary class')
     levin_class.save()
     verbnet_class = VerbNetClass(levin_class=levin_class, name='imagine-4', position=1)
     verbnet_class.save()
     self.frameset = VerbNetFrameSet(verbnet_class=verbnet_class, name='4')
     self.frameset.save()
コード例 #2
0
    def setUp(self):
        """Adds a class and a subclass that will get hidden: we'll see how
        things are moved around."""

        # VerbNet class with its parent Levin class
        levin_class = LevinClass(number=4, name='Imaginary class')
        levin_class.save()
        verbnet_class = VerbNetClass(levin_class=levin_class, name='imagine-4', position=1)
        verbnet_class.save()

        # A frameset and its child with verbs in both
        self.root_frameset = VerbNetFrameSet(verbnet_class=verbnet_class,
                                             name='4')
        self.root_frameset.save()
        self.child_frameset = VerbNetFrameSet(verbnet_class=verbnet_class,
                                              parent=self.root_frameset,
                                              name='4.1')
        self.child_frameset.save()

        VerbNetMember(frameset=self.root_frameset, lemma='member_root-1').save()
        VerbNetMember(frameset=self.root_frameset, lemma='member_root-2').save()
        VerbNetMember(frameset=self.child_frameset, lemma='member_child-1').save()
        VerbNetMember(frameset=self.child_frameset, lemma='member_child-2').save()
        VerbTranslation(frameset=self.child_frameset, verb='translation_child-1',
                        category_id=4, category='unknown',
                        validation_status=VerbTranslation.STATUS_VALID).save()
        VerbTranslation(frameset=self.child_frameset, verb='translation_child-2',
                        category_id=4, category='unknown',
                        validation_status=VerbTranslation.STATUS_INFERRED).save()

        # Another target frameset with a child in a new VerbNet class where we'll send verbs from
        # the other child_frameset before hiding the target frameset child
        second_verbnet_class = VerbNetClass(levin_class=levin_class, name='boring-5', position=1)
        second_verbnet_class.save()
        self.target_frameset = VerbNetFrameSet(verbnet_class=second_verbnet_class,
                                               name='5')
        self.target_frameset.save()
        self.target_frameset_child = VerbNetFrameSet(verbnet_class=second_verbnet_class,
                                                     parent=self.target_frameset,
                                                     name='5.1')
        self.target_frameset_child.save()
        VerbNetMember(frameset=self.target_frameset, lemma='member_target-1').save()
        VerbNetMember(frameset=self.target_frameset_child, lemma='member_target_child-1').save()
コード例 #3
0
ファイル: testexport.py プロジェクト: aymara/verbenet-editor
    def test_lvf_ladl(self):
        levin_class = LevinClass(number=10, name="Removing")
        levin_class.save()
        vn_class = VerbNetClass(levin_class=levin_class, name="clear-10.3", position=1)
        vn_class.save()
        root_frameset = VerbNetFrameSet(
            verbnet_class=vn_class,
            name="10.3",
            paragon="nettoyer",
            comment="plutôt vider ?",
            ladl_string="37E et 38LS",
            lvf_string="N3d",
        )
        root_frameset.save()
        child_frameset = VerbNetFrameSet(
            verbnet_class=vn_class, parent=root_frameset, name="10.3-1", paragon="nettoyer", comment="plutôt vider ?"
        )
        child_frameset.save()
        xml_vnclass = export_subclass(root_frameset, vn_class.name)
        assert ET.tostring(xml_vnclass).decode("UTF-8") == (
            u'<VNCLASS ID="clear-10.3" ladl="37E et 38LS" lvf="N3d">'
            "<MEMBERS /><THEMROLES /><FRAMES />"
            "<SUBCLASSES>"
            '<VNSUBCLASS ID="clear-10.3-1">'
            "<MEMBERS /><THEMROLES /><FRAMES /></VNSUBCLASS>"
            "</SUBCLASSES>"
            "</VNCLASS>"
        )

        # Clear ladl/lvf and ensure they are empty in the XML
        root_frameset.ladl_string = ""
        root_frameset.lvf_string = None
        xml_vnclass = export_subclass(root_frameset, "clear-10.3")
        assert ET.tostring(xml_vnclass).decode("UTF-8") == (
            u'<VNCLASS ID="clear-10.3">'
            "<MEMBERS /><THEMROLES /><FRAMES />"
            "<SUBCLASSES>"
            '<VNSUBCLASS ID="clear-10.3-1">'
            "<MEMBERS /><THEMROLES /><FRAMES /></VNSUBCLASS>"
            "</SUBCLASSES>"
            "</VNCLASS>"
        )
コード例 #4
0
    def setUp(self):
        """
        Tests syntacticframes.models.VerbNetFrameSet.update_translations.

        Add three framesets with one English member each: we want everyone of
        those verbs to have at least one French translation in common. We will
        then see, depending on the LVF/LADL mappings, what will be the
        different colors of the French translation.
        """
        # VerbNet class with its parent Levin class
        levin_class = LevinClass(number=3, name='Another imaginary class')
        levin_class.save()
        self.verbnet_class = VerbNetClass(levin_class=levin_class, name='another-3', position=1)
        self.verbnet_class.save()

        # A frameset and its child with verbs in both
        self.root_frameset = VerbNetFrameSet(verbnet_class=self.verbnet_class,
                                             name='3',lvf_string='L1a')
        self.root_frameset.save()
        self.child_frameset = VerbNetFrameSet(verbnet_class=self.verbnet_class,
                                              parent=self.root_frameset,
                                              name='3.1')
        self.child_frameset.save()
        self.grandchild1_frameset = VerbNetFrameSet(verbnet_class=self.verbnet_class,
                                                   parent=self.child_frameset,
                                                   name='3.1.1')
        self.grandchild1_frameset.save()
        self.grandchild2_frameset = VerbNetFrameSet(verbnet_class=self.verbnet_class,
                                                   parent=self.child_frameset,
                                                   name='3.1.2')
        self.grandchild2_frameset.save()

        VerbNetMember(frameset=self.root_frameset, lemma='live').save()
        VerbNetMember(frameset=self.child_frameset, lemma='stay').save()
        VerbNetMember(frameset=self.grandchild1_frameset, lemma='stop').save()
        VerbNetMember(frameset=self.grandchild2_frameset, lemma='remain').save()

        self.verbnet_class.update_members_and_translations()