def load_txt_for_docs(conn_meta, query):
    """
    loads texts for documents
    @param conn_meta: connection to the metadata database
    @param query: query to obtain the text for a pubmed doc
    @return: a dict which maps a pmid to a string
    """
    cur = conn_meta.cursor()
    cur.execute(query)
    rows = cur.fetchall()
    doc2meta = {}
    for r in rows:
        pmid, txt = str(r[0]), str(r[1])

        if pmid not in doc2meta:
            doc2meta[pmid] = txt
        else:
            raise Exception('do not expect documents to have multiple texts')

    return doc2meta