コード例 #1
0
def create_tag_docs(tag, label=None, count=None, mode='instagram'):
    """
        loads tags from file and turns them into documents
    """
    if not label:
        label = tag
    if mode == 'instagram':
        tag_media = loadpickle.get_all_tagpickles(tag, count, 'tag_pickles')
        tag_docs = create_instagram_document_index(tag_media, label)
    elif mode == 'twitter':
        tag_media = loadpickle.get_all_tagpickles(tag, count, 'tweet_pickles')
        tag_docs = create_tweet_document_index(tag_media, label)
    return tag_docs
コード例 #2
0
    def create_tag_docs(self):
        """
            uses tweet2document and instagram2document to produce pattern.Document representations
        """
        print "creating_tag_docs\t{0}".format(self)

        if self.mode == 'twitter':
            tag_docs = tweet2document.create_tweet_document_index(
                self.tag_media,
                self.label,
                self.max_documents)
        elif self.mode == 'instagram':
            tag_docs = instagram2document.create_instagram_document_index(
                self.tag_media,
                self.label,
                self.max_documents)
        self.tag_docs = tag_docs