예제 #1
0
 def make_ref(self, card, score, url, citation):
     data = {
         'citation': citation,
         'url': url,
         'source': 'OpenCorporates',
         'score': score,
         'source_url': 'https://opencorporates.com'
     }
     ref = Reference.find(card, data.get('url'))
     if ref is None:
         ref = Reference()
     ref.save(data, card, User.default_user())
예제 #2
0
 def make_ref(self, card, id, score, type_, record, idx):
     label = record.get('Citation', record.get('title', record.get('Name')))
     if len(label) > 80:
         label = label[:80] + '...'
     data = {
         'citation': '%s: %s' % (type_, label),
         'url': URL + 'homes/tree/%s#match%s' % (id, idx),
         'source': 'OpenDuka',
         'score': score,
         'source_url': 'http://openduka.org'
     }
     ref = Reference.find(card, data.get('url'))
     if ref is None:
         ref = Reference()
     ref.save(data, card, User.default_user())
예제 #3
0
파일: openduka.py 프로젝트: 01-/storyweb
 def make_ref(self, card, id, score, type_, record, idx):
     label = record.get('Citation',
                        record.get('title',
                                   record.get('Name')))
     if len(label) > 80:
         label = label[:80] + '...'
     data = {
         'citation': '%s: %s' % (type_, label),
         'url': URL + 'homes/tree/%s#match%s' % (id, idx),
         'source': 'OpenDuka',
         'score': score,
         'source_url': 'http://openduka.org'
     }
     ref = Reference.find(card, data.get('url'))
     if ref is None:
         ref = Reference()
     ref.save(data, card, User.default_user())
예제 #4
0
파일: extract.py 프로젝트: 01-/storyweb
def extract_multi(parent):
    seen = set([parent.id])
    for offset, card in extract_known(parent):
        if card.id not in seen:
            seen.add(card.id)
            yield offset, card

    for offset, data in extract_calais(parent.text):
        author = User.default_user()
        card = Card.find(data.get('title'))
        if card is None:
            card = Card()
        elif card.id in seen:
            continue
        else:
            data['text'] = card.text
            author = card.author
        card.save(data, author)
        seen.add(card.id)
        yield offset, card