Exemple #1
0
    def get_vocab_subjectpredicates(self, visualphrases):

        subjectpredicates = Vocabulary()
        for visualphrase in visualphrases.words():
            triplet = visualphrase.split('-')
            subjectpredicate = '-'.join([triplet[0], triplet[1]])
            if subjectpredicate not in subjectpredicates.words():
                subjectpredicates.add_word(subjectpredicate, 'noun-verb')

        return subjectpredicates
Exemple #2
0
    def get_vocab_objectpredicates(self, visualphrases):

        objectpredicates = Vocabulary()
        for visualphrase in visualphrases.words():
            triplet = visualphrase.split('-')
            objectpredicate = '-'.join([triplet[1], triplet[2]])
            if objectpredicate not in objectpredicates.words():
                objectpredicates.add_word(objectpredicate, 'verb-noun')

        return objectpredicates
Exemple #3
0
    def get_vocab_predicates(self, visualphrases):
        """
        no_interaction class already included
        """
        predicates = Vocabulary()
        predicates.add_word('no interaction', 'verb')
        for visualphrase in visualphrases.words():
            triplet = visualphrase.split('-')
            predicate = triplet[1]
            if predicate not in predicates.words():
                predicates.add_word(predicate, 'verb')

        return predicates