def aggregateFormulaFeatureMaps(fMap, onlyTheorems, ignoreNumbers): documentFeatureMap = { } for fid, features in fMap.items(): if ignoreNumbers: features = dict(filter(lambda kv : not(kv[0][:3] == "num"), features.items())) if not onlyTheorems or re.search(r"thm", fid.lower()): addToDict(documentFeatureMap, features) return documentFeatureMap
def aggregateFormulaFeatureMaps(fMap, onlyTheorems, ignoreNumbers): documentFeatureMap = {} for fid, features in fMap.items(): if ignoreNumbers: features = dict( filter(lambda kv: not (kv[0][:3] == "num"), features.items())) if not onlyTheorems or re.search(r"thm", fid.lower()): addToDict(documentFeatureMap, features) return documentFeatureMap
def formulasToFeatureCounts(formulaIds): formulaFile = "derived_data/formula_features/" + filter(lambda c : c in (digits + ascii_letters), documentId) + ".json" formulas = json.load(open(formulaFile)) m = { } formulaFeatureList = map(lambda fid : formulas[fid], formulaIds) for formulaFeatureMap in formulaFeatureList: addToDict(m, formulaFeatureMap) return m
def formulasToFeatureCounts(formulaIds): formulaFile = "derived_data/formula_features/" + filter( lambda c: c in (digits + ascii_letters), documentId) + ".json" formulas = json.load(open(formulaFile)) m = {} formulaFeatureList = map(lambda fid: formulas[fid], formulaIds) for formulaFeatureMap in formulaFeatureList: addToDict(m, formulaFeatureMap) return m