parameters: (oref)
return_statement: return [Recommendation(Ref(r), relevance=d["score"], sources=[RecommendationSource(d["source"], d["anchor_ref"])]) for (r, _), d in list(included_ref_dict.items())]
docstring: :param oref:
          :return: list of tuples, each one with (tref, score, way of connection[str])
function: def get_recs_thru_sheets(oref):
          '''
  
          :param oref:
          :return: list of tuples, each one with (tref, score, way of connection[str])
          '''
          sheets = []
          section_ref_list = [r.section_ref() for r in oref.split_spanning_ref()]
          range_set = {r.normal() for r in oref.all_segment_refs()}
          for section_ref in section_ref_list:
              regex_list = section_ref.regex(as_list=True)
              ref_clauses = [{"includedRefs": {"$regex": r}} for r in regex_list]
              query = {"status": "public", "$or": ref_clauses, "viaOwner": {"$exists": 0}, "assignment_id": {"$exists": 0}}
              sheets_cursor = db.sheets.find(query, {"includedRefs": 1, "owner": 1, "id": 1, "tags": 1, "title": 1})
              sheets += [s for s in sheets_cursor if RecommendationEngine.is_interesting_sheet(s)]
          included_ref_dict = {}
          for sheet in sheets:
              temp_included, focus_range_factor, _, focus_ref_subref = RecommendationEngine.normalize_related_refs(sheet.get("includedRefs", []), range_set, SHEET_REF_SCORE, check_has_ref=True, count_steinsaltz=True)
              if focus_range_factor == 0:
                  continue
              ref_owner_keys = [(r, sheet["owner"]) for r in temp_included]
              for k in ref_owner_keys:
                  if (k in included_ref_dict and included_ref_dict[k]["score"] < focus_range_factor) or k not in included_ref_dict:
                      included_ref_dict[k] = {"score": focus_range_factor, "source": "Sheet " + str(sheet["id"]), "anchor_ref": focus_ref_subref}
  
          return [Recommendation(Ref(r), relevance=d["score"], sources=[RecommendationSource(d["source"], d["anchor_ref"])]) for (r, _), d in list(included_ref_dict.items())]
function_tokens: def get_recs_thru_sheets ( oref ) : sheets = [ ] section_ref_list = [ r . section_ref ( ) for r in oref . split_spanning_ref ( ) ] range_set = { r . normal ( ) for r in oref . all_segment_refs ( ) } for section_ref in section_ref_list : regex_list = section_ref . regex ( as_list = True ) ref_clauses = [ { "includedRefs" : { "$regex" : r } } for r in regex_list ] query = { "status" : "public" , "$or" : ref_clauses , "viaOwner" : { "$exists" : 0 } , "assignment_id" : { "$exists" : 0 } } sheets_cursor = db . sheets . find ( query , { "includedRefs" : 1 , "owner" : 1 , "id" : 1 , "tags" : 1 , "title" : 1 } ) sheets += [ s for s in sheets_cursor if RecommendationEngine . is_interesting_sheet ( s ) ] included_ref_dict = { } for sheet in sheets : temp_included , focus_range_factor , _ , focus_ref_subref = RecommendationEngine . normalize_related_refs ( sheet . get ( "includedRefs" , [ ] ) , range_set , SHEET_REF_SCORE , check_has_ref = True , count_steinsaltz = True ) if focus_range_factor == 0 : continue ref_owner_keys = [ ( r , sheet [ "owner" ] ) for r in temp_included ] for k in ref_owner_keys : if ( k in included_ref_dict and included_ref_dict [ k ] [ "score" ] < focus_range_factor ) or k not in included_ref_dict : included_ref_dict [ k ] = { "score" : focus_range_factor , "source" : "Sheet " + str ( sheet [ "id" ] ) , "anchor_ref" : focus_ref_subref } return [ Recommendation ( Ref ( r ) , relevance = d [ "score" ] , sources = [ RecommendationSource ( d [ "source" ] , d [ "anchor_ref" ] ) ] ) for ( r , _ ) , d in list ( included_ref_dict . items ( ) ) ]