nodes: 0, module; 1, function_definition; 2, function_name:scores2recos; 3, parameters; 4, block; 5, identifier:self; 6, identifier:scores; 7, identifier:candidates; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, if_statement; 12, return_statement; 13, identifier:rev; 14, False; 15, comment:"""Get recommendation list for a user u_index based on scores.
  
          Args:
              scores (numpy array; (n_target_items,)):
                  Scores for the target items. Smaller score indicates a promising item.
              candidates (numpy array; (# target items, )): Target items' indices. Only these items are considered as the recommendation candidates.
              rev (bool): If true, return items in an descending order. A ascending order (i.e., smaller scores are more promising) is default.
  
          Returns:
              (numpy array, numpy array) : (Sorted list of items, Sorted scores).
  
          """; 16, assignment; 17, identifier:rev; 18, block; 19, expression_list; 20, identifier:sorted_indices; 21, call; 22, expression_statement; 23, subscript; 24, subscript; 25, attribute; 26, argument_list; 27, assignment; 28, identifier:candidates; 29, identifier:sorted_indices; 30, identifier:scores; 31, identifier:sorted_indices; 32, identifier:np; 33, identifier:argsort; 34, identifier:scores; 35, identifier:sorted_indices; 36, subscript; 37, identifier:sorted_indices; 38, slice; 39, unary_operator; 40, integer:1
code: def scores2recos(self, scores, candidates, rev=False):
          """Get recommendation list for a user u_index based on scores.
  
          Args:
              scores (numpy array; (n_target_items,)):
                  Scores for the target items. Smaller score indicates a promising item.
              candidates (numpy array; (# target items, )): Target items' indices. Only these items are considered as the recommendation candidates.
              rev (bool): If true, return items in an descending order. A ascending order (i.e., smaller scores are more promising) is default.
  
          Returns:
              (numpy array, numpy array) : (Sorted list of items, Sorted scores).
  
          """
          sorted_indices = np.argsort(scores)
  
          if rev:
              sorted_indices = sorted_indices[::-1]
  
          return candidates[sorted_indices], scores[sorted_indices]