mirror of
https://github.com/bellingcat/tiktok-hashtag-analysis.git
synced 2026-06-12 13:28:30 +03:00
updated command-line arguments in documentation, added gitignore, changed screenshots to text in README where possible, removed redundant imports and functions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import os, sys
|
||||
import csv, json
|
||||
import json
|
||||
import argparse
|
||||
import matplotlib.pyplot as plt
|
||||
from datetime import datetime
|
||||
@@ -96,7 +96,7 @@ if __name__ == "__main__":
|
||||
"-d" option prints the hashtag frequencies on the shell
|
||||
"-p" option plots the hashtag frequencies and saves as a png file in the folder /data/imgs/
|
||||
|
||||
The function get_occurances is triggered to compute and return the top n occurances and the hashtags.
|
||||
The function get_occurrences is triggered to compute and return the top n occurrences and the hashtags.
|
||||
"""
|
||||
img_folder = global_data.IMAGES
|
||||
file_methods.check_file(img_folder, "dir")
|
||||
@@ -113,11 +113,10 @@ if __name__ == "__main__":
|
||||
|
||||
base = os.path.splitext(args.input_file)[0]
|
||||
path = f"./{base}_sorted_hashtags.csv"
|
||||
occs = get_occurrences(args.input_file, args.n)
|
||||
if args.plot:
|
||||
occs = get_occurrences(args.input_file, args.n)
|
||||
plot(args.n, occs, img_folder)
|
||||
else:
|
||||
occs = get_occurrences(args.input_file, args.n)
|
||||
print_occurrences(occs)
|
||||
else:
|
||||
print(f'ERROR: either {args.input_file} or {args.n} or both contains error.')
|
||||
|
||||
Reference in New Issue
Block a user