def mashupAnnotatedBOWinlinkMethods(doc_incoming, exclude_files, max_year, method1, param1, inlink_parameter): """ Returns BOWs ready to add to indeces of different parameters for inlink_context """ doc_incoming_guid=doc_incoming.metadata["guid"] ilc_bow=cp.Corpus.loadPrebuiltBOW(doc_incoming_guid, "inlink_context", inlink_parameter) if ilc_bow is None: print("Prebuilt BOW not found for: inlink_context", inlink_parameter) return None # this is a dict representing the context and eventually a new "document" to be added to the index ilc_bow=joinTogetherContextExcluding(ilc_bow,exclude_files,max_year) bow_method1=getListAnyway(cp.Corpus.loadPrebuiltBOW(doc_incoming_guid,method1,param1)) res=[] for passage in bow_method1: addFieldsFromDicts(passage,ilc_bow) ## addDocBOWFullTextField(doc,res,doctext) res.append(passage) return res
def mashupBOWinlinkMethods(doc_incoming_guid, exclude_files, max_year, method_params, full_corpus=False): """ Returns BOWs ready to add to indeces of different parameters for inlink_context """ ilc_bow=cp.Corpus.loadPrebuiltBOW(doc_incoming_guid, {"method":method_params["ilc_method"], "parameter":method_params["ilc_parameter"]}) if ilc_bow is None: print("Prebuilt BOW not found for: inlink_context", method_params["ilc_method"] + method_params["ilc_parameter"]) return None # this is a dict representing the context and eventually a new "document" to be added to the index ilc_bow=filterInlinkContext(ilc_bow, exclude_files, max_year, full_corpus=full_corpus) # for some reason this shouldn't be a list ilc_bow=ilc_bow[0] bow_method1=getListAnyway(cp.Corpus.loadPrebuiltBOW(doc_incoming_guid,{"method":method_params["mashup_method"], "parameter":method_params["parameter"]})) res=[] for passage in bow_method1: addFieldsFromDicts(passage,ilc_bow) ## addDocBOWFullTextField(doc,res,doctext) res.append(passage) return res