コード例 #1
0
def _compare_names(bib1, bib2):
    metadata_comparison_print("Comparing names.")

    name1 = get_name_by_bibrecref(bib1)
    name2 = get_name_by_bibrecref(bib2)

    if name1 and name2:
        return compare_names(name1, name2, False)
    return "?"
コード例 #2
0
def export_to_dot(cs, fname, graph_info, extra_edge=None):
    from bibauthorid_dbinterface import get_name_by_bibrecref

    fptr = open(fname, "w")
    fptr.write("graph wedgy {\n")
    fptr.write("    overlap=prism\n")

    for idx, bib in enumerate(graph_info):
        fptr.write('    %d [color=black label="%s"];\n' %
                   (idx, get_name_by_bibrecref(idx)))

    if extra_edge:
        v1, v2, (prob, cert) = extra_edge
        fptr.write('    %d -- %d [color=green label="p: %.2f, c: %.2f"];\n' %
                   (v1, v2, prob, cert))

    for clus in cs.clusters:
        fptr.write("    %s [color=blue];\n" %
                   " -- ".join(str(x) for x in clus.bibs))

        fptr.write("".join("    %d -- %d [color=red]\n" % (b1, b2)
                           for b1 in clus.bibs for h in clus.hate
                           for b2 in h.bibs))

    fptr.write("}")
コード例 #3
0
def get_bibrefrec_name_string(bibref):
    '''
    Returns the name string associated to a name string
    @param bibref: bibrefrec '100:123,123'
    @return: string
    '''
    name = ""
    ref = ""

    if not ((bibref and isinstance(bibref, str) and bibref.count(":"))):
        return name

    if bibref.count(","):
        try:
            ref = bibref.split(",")[0]
        except (ValueError, TypeError, IndexError):
            return name
    else:
        ref = bibref

    table, ref = ref.split(":")
    dbname = get_name_by_bibrecref((int(table), int(ref)))

    if dbname:
        name = dbname

    return name
コード例 #4
0
def export_to_dot(cs, fname, graph_info, extra_edge=None):
    from bibauthorid_dbinterface import get_name_by_bibrecref

    fptr = open(fname, "w")
    fptr.write("graph wedgy {\n")
    fptr.write("    overlap=prism\n")

    for idx, bib in enumerate(graph_info):
        fptr.write('    %d [color=black label="%s"];\n' % (idx, get_name_by_bibrecref(idx)))

    if extra_edge:
        v1, v2, (prob, cert) = extra_edge
        fptr.write('    %d -- %d [color=green label="p: %.2f, c: %.2f"];\n' % (v1, v2, prob, cert))

    for clus in cs.clusters:
        fptr.write("    %s [color=blue];\n" % " -- ".join(str(x) for x in clus.bibs))

        fptr.write("".join("    %d -- %d [color=red]\n" % (b1, b2)
                      for b1 in clus.bibs for h in clus.hate for b2 in h.bibs))

    fptr.write("}")
コード例 #5
0
 def _find_names(bibs):
     return [get_name_by_bibrecref(bib) for bib in bibs]
コード例 #6
0
 def _find_names(bibs):
     return [get_name_by_bibrecref(bib) for bib in bibs]