Пример #1
0
def load_confrence_profiles(conf_id=1, name='niloy ganguly', papers_count=100, start_year=2000):
    try:
        conf = Confrence.objects.get(pk=conf_id)
    except:
        return False
    prof_set = Professor.objects.all().filter(name=name)
    
    for prof in prof_set:
        co_auth = ''
        cite_auth = ''
        ref_auth = ''
        search = GoogleScholarSearch()
        papers = search.search([prof.name], papers_count, start_year, 2011)

        co_auth_set = []
        for p in papers:
            #print p['URL']
            co_auth_set.append(str(p['Details']['title'])+','+','.join(p['Details']['authors']))

            cite_auth_set = []
            for c in p['Citations']:
                cite_auth_set.append(str(c['title'])+','+','.join(c['authors']))
            cite_auth = cite_auth + ';'.join(cite_auth_set)
            print cite_auth
            #return False

            ref_auth_set = []
            for r in p['References']:
                ref_auth_set.append(str(r['title'])+','+','.join(r['authors']))
            ref_auth = ref_auth + ';'.join(ref_auth_set)

        co_auth = co_auth + ';'.join(co_auth_set)

        co_auth = co_auth.encode('ascii', 'ignore')
        cite_auth = cite_auth.encode('ascii', 'ignore')
        ref_auth = ref_auth.encode('ascii', 'ignore')

        try:
            cp = ConfrenceProfile.objects.get(professor = prof, confrence = conf)
            cp.co_authors = co_auth
            cp.cite_authors = cite_auth
            cp.ref_authors = ref_auth
            cp.save()
        except:
            cp = ConfrenceProfile(professor = prof, confrence = conf, co_authors = co_auth, cite_authors = cite_auth, ref_authors = ref_auth)
            cp.save()
Пример #2
0
def create_confrence_profile(prof, confrence, papers_count=1000, start_year=1960):
    prof = prof    
    co_auth = ''
    cite_auth = ''
    ref_auth = ''

    try:
        cp = ConfrenceProfile.objects.get(professor = prof, confrence = confrence)
        cp.co_authors = co_auth
        cp.cite_authors = cite_auth
        cp.ref_authors = ref_auth
        cp.save()
    except:
        cp = ConfrenceProfile(professor = prof, confrence = confrence, co_authors = co_auth, cite_authors = cite_auth, ref_authors = ref_auth)
        cp.save()

    search = GoogleScholarSearch()
    search.search([prof.name], papers_count, start_year, datetime.datetime.now().year, cp)
    
    return True