class_docstr: Term Frequency - Inverse Document Frequency (TF-IDF) Recommender
  
  This class provides content-based recommendations using TF-IDF vectorization in combination with cosine similarity.
docstr: Restructures results dictionary into a table containing only the top k recommendations per item.
  
  Args:
      df_clean (pandas.DataFrame): Dataframe with cleaned text.
      k (int): Number of recommendations to return.
docstr_tok: ["Restructures","results","dictionary","into","a","table","containing","only","the","top","k","recommendations","per","item",".","Args",":","df_clean","(","pandas.DataFrame",")",":","Dataframe","with","cleaned","text",".","k","(","int",")",":","Number","of","recommendations","to","return","."]
code: def __organize_results_as_tabular(self, df_clean, k):
      """Restructures results dictionary into a table containing only the top k recommendations per item.
  
      Args:
          df_clean (pandas.DataFrame): Dataframe with cleaned text.
          k (int): Number of recommendations to return.
      """
      # Initialize new dataframe to hold recommendation output
      item_id = list()
      rec_rank = list()
      rec_score = list()
      rec_item_id = list()
  
      # For each item
      for _item_id in self.recommendations:
          # Information about the item we are basing recommendations off of
          rec_based_on = tmp_item_id = _item_id
  
          # Get all scores and IDs for items recommended for this current item
          rec_array = self.recommendations.get(rec_based_on)
          tmp_rec_score = list(map(lambda x: x[0], rec_array))
          tmp_rec_id = list(map(lambda x: x[1], rec_array))
  
          # Append multiple values at a time to list
          item_id.extend([tmp_item_id] * k)
          rec_rank.extend(list(range(1, k + 1)))
          rec_score.extend(tmp_rec_score[:k])
          rec_item_id.extend(tmp_rec_id[:k])
  
      # Save the output
      output_dict = {
          self.id_col: item_id,
          "rec_rank": rec_rank,
          "rec_score": rec_score,
          "rec_" + self.id_col: rec_item_id,
      }
  
      # Convert to dataframe
      self.top_k_recommendations = pd.DataFrame(output_dict)
  
imports: from sklearn.feature_extraction.text import TfidfVectorizer
  from sklearn.metrics.pairwise import linear_kernel
  from transformers import BertTokenizer
  import re
  import unicodedata
  import pandas
  import numpy
  import nltk
  from nltk.stem.porter import PorterStemmer
label_desc: Use image node_id 9 for calling the TfidfRecommender obj's underlying member method code with example usage: obj.__organize_results_as_tabular(df_clean, k) without return types