Esempio n. 1
0
def add_inc_wiki_articles():
    for art in IArticle.objects.iterator():
        try:
            master = art.match_master
            wa = Article.objects.get(name=master.name.replace('_', ' '))
            if art.name == wa.name:
                continue

            try:
                bla = IArticle.objects.filter(name=wa.name+'waw', art_ed=1000)
                if bla.count() > 0:
                    continue
            except:
                pass
        
            a = IArticle(name=wa.name, art_id=wa.wid, art_ed=1000, text='', prank=0.0, 
                         volume_score=wa.vscore, match_master=master, match_score=1.0)
            a.save()
            print a.name, 'incwiki'
        except:
            pass
Esempio n. 2
0
def insert_incunabula_articles(revw):
    c = 0
    sizes = revw['sizes']
    for k in revw.keys():
        try:
            ma = IMasterArticle.objects.get(name=k)

            for ed in revw[k]['editions']:
                a = revw[k]['editions'][ed][0]

                ia = IArticle(name=a['name'], art_id=a['id'], art_ed=ed, text=a['txt'],
                              prank=0.0, volume_score= (0.0 + len(a['txt'])) / sizes[ed],
                              match_master=ma, 
                              match_score=-1.0)
                #print a['name']
                ia.save()
        except:
            continue
            
        print c
        c+=1
        if LIMIT > 0 and c > LIMIT:
            print 'wtf>'
            break