Skip to content

Instantly share code, notes, and snippets.

View richard-jones's full-sized avatar

Richard Jones richard-jones

View GitHub Profile
@richard-jones
richard-jones / medline2json.py
Created February 17, 2012 11:08
Convert Medline XML to JSON for indexing in Elastic Search
from lxml import etree
import json
outfile = open("kv.json", "w+")
outfile.write("[\n")
tree = etree.parse("medline11n0001.xml")
elem = tree.getroot()
# for every item in the xml file, parse it and create a JSON object of it