original_docstring: Calculate token frequencies and tf-idf scores and put them into one Dataframe.
  
      Args:
          df_papers: Dataframe with the papers to process.
          ngrams: The lower and upper bound of the n_grams, e.g. "1", "2", "1,2" or "1, 3".
  
      Returns:
          Dataframe with all terms and their tf and tf-idf scores.
      
docstring: Calculate token frequencies and tf-idf scores and put them into one Dataframe.
docstring_tokens: Calculate token frequencies and tf - idf scores and put them into one Dataframe .
code: def token_frequencies(df_papers: pd.DataFrame, ngrams: str) -> pd.DataFrame:
      """Calculate token frequencies and tf-idf scores and put them into one Dataframe.
  
      Args:
          df_papers: Dataframe with the papers to process.
          ngrams: The lower and upper bound of the n_grams, e.g. "1", "2", "1,2" or "1, 3".
  
      Returns:
          Dataframe with all terms and their tf and tf-idf scores.
      """
      ngrams_list = filter_.attributes_to_list(ngrams)
      if len(ngrams_list) > 1:
          n_upper = ngrams_list[1]
      else:
          n_upper = ngrams_list[0]
  
      documents = list(df_papers[COLUMN_ABSTRACT].dropna()) + list(df_papers["AA title"].dropna())
      feature_names, counts_matrix, tfidf_matrix = generate_token_matrices(
          documents, int(ngrams_list[0]), int(n_upper)
      )
      tf_score = np.asarray(counts_matrix.sum(axis=0))[0]
      idf_score = tfidf_matrix.idf_
      data = {"tf": tf_score, "tfidf": tf_score * idf_score}
      df_freq = pd.DataFrame(data=data, index=feature_names)
      return df_freq
code_tokens: def token_frequencies ( df_papers : pd . DataFrame , ngrams : str ) -> pd . DataFrame : ngrams_list = filter_ . attributes_to_list ( ngrams ) if len ( ngrams_list ) > 1 : n_upper = ngrams_list [ 1 ] else : n_upper = ngrams_list [ 0 ] documents = list ( df_papers [ COLUMN_ABSTRACT ] . dropna ( ) ) + list ( df_papers [ "AA title" ] . dropna ( ) ) feature_names , counts_matrix , tfidf_matrix = generate_token_matrices ( documents , int ( ngrams_list [ 0 ] ) , int ( n_upper ) ) tf_score = np . asarray ( counts_matrix . sum ( axis = 0 ) ) [ 0 ] idf_score = tfidf_matrix . idf_ data = { "tf" : tf_score , "tfidf" : tf_score * idf_score } df_freq = pd . DataFrame ( data = data , index = feature_names ) return df_freq
short_docstring: Calculate token frequencies and tf-idf scores and put them into one Dataframe.
short_docstring_tokens: Calculate token frequencies and tf - idf scores and put them into one Dataframe .
comment: """Calculate token frequencies and tf-idf scores and put them into one Dataframe.
  
      Args:
          df_papers: Dataframe with the papers to process.
          ngrams: The lower and upper bound of the n_grams, e.g. "1", "2", "1,2" or "1, 3".
  
      Returns:
          Dataframe with all terms and their tf and tf-idf scores.
      """