original_docstring: Plot the counts of all terms, that were in a top k in at least one year, over time.
      The time can be selected via the filters.
  
      Args:
          df_papers: Dataframe with the papers to process.
          k: Determines how many tokens are shown.
          ngrams: The lower and upper bound of the n_grams, e.g. "1", "2", "1,2" or "1, 3"
          name: Name of the output image.
          tfidf: If True, will rank by tf-idf not tf scores.
          filters: Dict of filters applied.
      
docstring: Plot the counts of all terms, that were in a top k in at least one year, over time.
  The time can be selected via the filters.
docstring_tokens: Plot the counts of all terms that were in a top k in at least one year over time . The time can be selected via the filters .
code: def counts_over_time(
      df_papers: pd.DataFrame,
      k: int,
      ngrams: str,
      name: str,
      tfidf: bool,
      filters: Dict[str, FILTER_DATATYPES],
  ) -> None:
      """Plot the counts of all terms, that were in a top k in at least one year, over time.
      The time can be selected via the filters.
  
      Args:
          df_papers: Dataframe with the papers to process.
          k: Determines how many tokens are shown.
          ngrams: The lower and upper bound of the n_grams, e.g. "1", "2", "1,2" or "1, 3"
          name: Name of the output image.
          tfidf: If True, will rank by tf-idf not tf scores.
          filters: Dict of filters applied.
      """
      if tfidf:
          mode = "tfidf"
          filters["tfidf"] = True
      else:
          mode = "tf"
  
      years_freqs = {}
      tokens = set()
      years = sorted(df_papers["AA year of publication"].unique())
      for year in years:
          df_year = df_papers[df_papers["AA year of publication"] == year]
          count_top = token_frequencies(df_year, ngrams).sort_values(by=[mode], ascending=False)
          tokens.update(count_top.head(k).index)
          years_freqs[str(year)] = count_top
      df_years = pd.concat(years_freqs, axis=1)
  
      for token in tokens:
          plt.plot(years, df_years.loc[token, (slice(None), mode)], label=token)
      plt.xlabel("year")
      plt.ylabel(mode)
      plt.title(filter_.category_names(filters))
      plt.legend(bbox_to_anchor=(1, 1), loc="upper left")
      plt.ticklabel_format(useOffset=False)
      plt.xticks(years)
      plt.tight_layout()
  
      if name is None:
          name = f"ct_{CURRENT_TIME}"
      path = f"output/counts/{name}.png"
      plt.savefig(path)
      print(f"File created at {os.path.abspath(path)}")
code_tokens: def counts_over_time ( df_papers : pd . DataFrame , k : int , ngrams : str , name : str , tfidf : bool , filters : Dict [ str , FILTER_DATATYPES ] , ) -> None : if tfidf : mode = "tfidf" filters [ "tfidf" ] = True else : mode = "tf" years_freqs = { } tokens = set ( ) years = sorted ( df_papers [ "AA year of publication" ] . unique ( ) ) for year in years : df_year = df_papers [ df_papers [ "AA year of publication" ] == year ] count_top = token_frequencies ( df_year , ngrams ) . sort_values ( by = [ mode ] , ascending = False ) tokens . update ( count_top . head ( k ) . index ) years_freqs [ str ( year ) ] = count_top df_years = pd . concat ( years_freqs , axis = 1 ) for token in tokens : plt . plot ( years , df_years . loc [ token , ( slice ( None ) , mode ) ] , label = token ) plt . xlabel ( "year" ) plt . ylabel ( mode ) plt . title ( filter_ . category_names ( filters ) ) plt . legend ( bbox_to_anchor = ( 1 , 1 ) , loc = "upper left" ) plt . ticklabel_format ( useOffset = False ) plt . xticks ( years ) plt . tight_layout ( ) if name is None : name = f"ct_{CURRENT_TIME}" path = f"output/counts/{name}.png" plt . savefig ( path ) print ( f"File created at {os.path.abspath(path)}" )
short_docstring: Plot the counts of all terms, that were in a top k in at least one year, over time.
short_docstring_tokens: Plot the counts of all terms that were in a top k in at least one year over time .
comment: """Plot the counts of all terms, that were in a top k in at least one year, over time.
      The time can be selected via the filters.
  
      Args:
          df_papers: Dataframe with the papers to process.
          k: Determines how many tokens are shown.
          ngrams: The lower and upper bound of the n_grams, e.g. "1", "2", "1,2" or "1, 3"
          name: Name of the output image.
          tfidf: If True, will rank by tf-idf not tf scores.
          filters: Dict of filters applied.
      """