Ejemplo n.º 1
0
def main():
    from general_utils import loadFileText
    from reference_formatting import formatReference

    reader=ParsCitReader()
    loaded=reader.parseParsCitXML(loadFileText(r"G:\NLP\ParsCit-win\example.xml"))
    for ref in loaded:
        print formatReference(ref)
    pass
Ejemplo n.º 2
0
        def recurseSectionsBibliography(biblos, embedding_level, glob):
            embedding_level+=1
            res=""

            if isinstance(biblos,dict) and biblos.has_key("references"):
                if biblos.has_key("header"):
                    res += addHeader (biblos, embedding_level, glob)
                thelist=biblos["references"]
            elif isinstance(biblos,list):
                thelist=biblos
            else:
                raise ValueError("Bibliography in the wrong format")

            for ref in thelist:
                if ref["type"]=="subsection":
                    res+=recurseSectionsBibliography(ref, embedding_level, glob)
                elif ref["type"]=="reference":
                    if ref.get("text","") != "":
                        reftext=ref["text"]
                    else:
                        reftext=formatReference(ref)
                    html_ref=glob["reference_formatting_function"](reftext,glob,ref)
                    res+=html_ref
            embedding_level-=1
            return res
Ejemplo n.º 3
0
def main():
    from general_utils import loadFileText
    from reference_formatting import formatReference

    reader=CermineReader()
    loaded=reader.parseCermineXML(loadFileText(r"G:\NLP\Cermine-win\example.xml"))
    for ref in loaded:
        print(formatReference(ref))
    pass