Explorar el Código

Output the statistics for .csv output

Xi Ruoyao hace 5 años
padre
commit
9782391717
Se han modificado 1 ficheros con 7 adiciones y 0 borrados
  1. 7 0
      wordfreq.py

+ 7 - 0
wordfreq.py

@@ -79,6 +79,13 @@ def main():
     if args.debug:
     if args.debug:
         print(c)
         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
     mask = None
     if not args.mask is None:
     if not args.mask is None:
         from PIL import Image
         from PIL import Image