Browse Source

Output the statistics for .csv output

Xi Ruoyao 5 years ago
parent
commit
9782391717
1 changed files with 7 additions and 0 deletions
  1. 7 0
      wordfreq.py

+ 7 - 0
wordfreq.py

@@ -79,6 +79,13 @@ def main():
     if args.debug:
         print(c)
 
+    # recognize .csv output and skip wordcloud
+    if args.output[-4:] == '.csv':
+        with open(args.output, mode="w") as ofile:
+            for i in c:
+                ofile.write(i + ',' + str(c[i]) + '\n')
+        return
+
     mask = None
     if not args.mask is None:
         from PIL import Image