def test_guess_genders(self):
        d = Document()
        d.text = 'Fred Astair did something. He also did something else.'

        de = DocumentEntity()
        de.document = d
        de.entity = Entity.query.get(self.fx.EntityData.sue_no_gender.id)
        de.offset_list = '27:2'

        self.db.session.add(d)

        self.ex.guess_genders(d)
        self.assertEqual('Male', d.entities[0].entity.person.gender.name)
    def test_guess_genders(self):
        d = Document.query.get(self.fx.DocumentData.simple.id)
        d.text = 'Fred Astair did something. He also did something else.'

        de = DocumentEntity()
        de.document = d
        de.relevance = 1.0
        de.entity = Entity.query.get(self.fx.EntityData.sue_no_gender.id)
        de.offset_list = '27:2'

        self.db.session.add(d)

        self.ex.guess_genders(d)
        self.assertEqual('Male', d.entities[0].entity.person.gender.name)
示例#3
0
    def test_delete_document(self):
        doc = Document()
        doc.text = 'And Fred said "Hello" to everyone.'
        doc.published_at = datetime.datetime.utcnow()
        
        u = Utterance()
        u.entity = Entity()
        u.entity.group = 'person'
        u.entity.name = 'Fred'
        u.quote = 'Hello'
        self.assertTrue(doc.add_utterance(u))

        de = DocumentEntity()
        de.document = doc
        de.entity = Entity.query.first()
        de.relevance = 0.5

        self.db.session.add(doc)
        self.db.session.commit()

        self.db.session.delete(doc)
        self.db.session.commit()
示例#4
0
    def test_delete_document(self):
        doc = self.doc
        doc.text = u'And Fred said "Hello" to everyone.'
        doc.published_at = datetime.datetime.utcnow()

        u = Utterance()
        u.entity = Entity()
        u.entity.group = 'person'
        u.entity.name = u'Fred'
        u.quote = u'Hello'
        self.assertTrue(doc.add_utterance(u))

        de = DocumentEntity()
        de.document = doc
        de.relevance = 0.5
        de.entity = Entity.query.first()

        self.db.session.add(doc)
        self.db.session.commit()

        self.db.session.delete(doc)
        self.db.session.commit()