Anagolous: weightings: OftenNear 1 LocationOf 5 UsedFor 12 PropertyOf 12 edge 0 = pred, 1 = src, 2 = dst candidates_fw_list = [ src_node (original dst node from our origin srcnode link) relation_type dst_node_list ] potato chips \ IsA \ junk food / IsA / candy - analogous: - get edges for origin node - iterate through edges -common_relation = edge->relation -common_node = edge->dst -edges2 = get backward edges for common_node -iterate through edges2 - if src != origin_node_name && relation == common_relation - candidate_node = edge2->src - add candidate_node+pred_common_node to candidates_list - add to candidates_list[candidate_node] - add to relation_list within candidate_list[candidate_node] common_relation,common_node NO- delete all candidates_list nodes w/ key shorter than 2 bytes NO- create candidates_weight_list as copy of [candidates_list,0] - iterate through candidates_weight_list - relation_types = "" - iterate through candidates_weight_list[i] - entry = candidates_fw_list[i][j] - entry_pred = entry[0] - pred_numberless = entry_pred - if entry_pred not in relation_type_map - if entry_pred != OftenNear - add relation to relation_type_map - if relation = OftenNear - candidates_weight_list[i].weight += 1 - if relation = LocationOf - candidates_weight_list[i].weight += 5 - if relation = UsedFor or PropertyOf - candidates_weight_list[i].weight += 12 - else - candidates_weight_list[i].weight += 8 - add the following to candidates_weight_list[i].weight: (25 * relation_type_map.size()) -CURRENTLY_HERE-*************************************** - sort candidate_weight_list based on weights - iterate through nodes - tmp_weight = node_weight / 200.0 - if tmp_weight < 0.9 - tmp_weight = 0.9 - node_weight += tmp_weight - take top X number of results (based on max_results) get context: discount_factor = 0.5 - get nodeids for list of input nodes - queue nodeids w/ score of 1.0 - iterate through queue (note, items are being added to queue during iter) - get connecting nodeids - queue connecting nodeids + (iterated_node_score * discount_factor) - iterate through queue again - break if max_nodes_visited - get node_score - get node_lookup_table_score (or 0.0 if none exists) - get max_score from (node_score vs. lookup_score) - get min_score from (node_score vs. lookup score) - new score = max_score + ((1.0 - max_score) * min_score) - update node_lookup_table_score with new_score - delete all origin nodes from queue - sort results - take top X number of results (based on max_results) --- highlevel: tokenize(text) tag_text(text) find_analogous_nodes(name) find_paths_from_a_to_b(node1, node2, sentences_p=0, max_visit=10000, max_result=200, restrict_pred=) get_context(nodelist, max_visit=1000, max_result=200) lowlevel: get-> edges-> by: origin-> nodename nodeid destination-> nodename nodeid edgeid edgeids-> by: origin-> nodename nodeid destination-> nodename nodeid nodename-> by: nodeid nodeid-> by: nodename predicate-> by: edgeid sentence-> by: edgeid