stijgers2json.py

This commit is contained in:
Peter Kleiweg
2026-06-19 17:53:03 +02:00
parent 802a84a929
commit c2389c65af
3 changed files with 121 additions and 15 deletions

View File

@@ -58,6 +58,7 @@ def corpus_stats(word, counts_recent, counts_reference, total_recent, total_refe
oudfile = sys.argv[1]
nieuwfile = sys.argv[2]
textfile = sys.argv[3]
counts_recent = {}
counts_reference = {}
@@ -95,7 +96,9 @@ for r, p_adj in zip(results, p_adjusted):
results = pd.DataFrame(results)
print("STIJGERS")
print(results[results.pct_diff > 0].sort_values('g2', ascending=False)[:40].to_string())
print("\nDALERS")
print(results[results.pct_diff < 0].sort_values('g2', ascending=False)[:40].to_string())
with open(textfile, "wt", encoding="utf-8") as fp:
fp.write("STIJGERS\n")
fp.write(results[results.pct_diff > 0].sort_values('g2', ascending=False)[:40].to_string())
fp.write("\n\nDALERS\n")
fp.write(results[results.pct_diff < 0].sort_values('g2', ascending=False)[:40].to_string())
fp.write("\n")