sbool indexedSimpleWikipedia_magicMap_debug; srecord WikiPage(S title, S text) {} static Map indexedSimpleWikipedia_magicMap(final Map map) { final File f = unpackSimpleWikipedia(); Map actualMap = new TreeMap(caseInsensitiveComparator()) { public WikiPage get(O title) { IndexedWikiPage ip = map.get(title); if (ip == null) null; S xml = loadTextFilePart(f, ip.start, ip.start+ip.len); if (indexedSimpleWikipedia_magicMap_debug) { print("Loaded from " + ip.start + " to " + (ip.start+ip.len)); printIndent(xml); } L tok = htmlTok(xml); S realTitle = trim(htmldecode(join(contentsOfContainerTag(tok, "title")))); S text = trim(htmldecode(join(contentsOfContainerTag(tok, "text")))); ret WikiPage(realTitle, text); } }; for (S title : keys(map)) actualMap.put(title, null); // dummy entry to have key ret actualMap; }