- sims = sims.rename({i: sr for i, sr in enumerate(names.subreddit.values)}, axis=1)
- sims['_subreddit'] = names.subreddit.values
-
- write_weekly_similarities(outfile, sims, week, names)
-
-#tfidf = spark.read.parquet('/gscratch/comdata/users/nathante/subreddit_tfidf_weekly.parquet')
-def cosine_similarities_weekly(tfidf_path, outfile, term_colname, min_df = None, included_subreddits = None, topN = 500):
- spark = SparkSession.builder.getOrCreate()
- conf = spark.sparkContext.getConf()
- print(outfile)
- tfidf = spark.read.parquet(tfidf_path)
+ entries = pull_tfidf(infile = tfidf_path,
+ term_colname=term_colname,
+ min_df=min_df,
+ max_df=max_df,
+ included_subreddits=included_subreddits,
+ topN=topN,
+ week=week.isoformat(),
+ rescale_idf=False)