X-Git-Url: https://code.communitydata.science/cdsc_reddit.git/blobdiff_plain/14ab979f5910637809dec24617276eb7bd0d9554..541e125b28dbca5c06d2160a5cd59ce112657b2a:/similarities/cosine_similarities.py?ds=sidebyside diff --git a/similarities/cosine_similarities.py b/similarities/cosine_similarities.py index cc681b1..b9bab17 100644 --- a/similarities/cosine_similarities.py +++ b/similarities/cosine_similarities.py @@ -2,11 +2,14 @@ import pandas as pd import fire from pathlib import Path from similarities_helper import similarities, column_similarities +from functools import partial def cosine_similarities(infile, term_colname, outfile, min_df=None, max_df=None, included_subreddits=None, topN=500, exclude_phrases=False, from_date=None, to_date=None, tfidf_colname='tf_idf'): return similarities(infile=infile, simfunc=column_similarities, term_colname=term_colname, outfile=outfile, min_df=min_df, max_df=max_df, included_subreddits=included_subreddits, topN=topN, exclude_phrases=exclude_phrases,from_date=from_date, to_date=to_date, tfidf_colname=tfidf_colname) +# change so that these take in an input as an optional argument (for speed, but also for idf). +def term_cosine_similarities(outfile, min_df=None, max_df=None, included_subreddits=None, topN=500, exclude_phrases=False, from_date=None, to_date=None): def term_cosine_similarities(outfile, infile='/gscratch/comdata/output/reddit_similarity/tfidf/comment_terms_100k.parquet', min_df=None, max_df=None, included_subreddits=None, topN=500, exclude_phrases=False, from_date=None, to_date=None):