|
@@ -60,6 +60,9 @@ def main():
|
|
|
help = "the width of canvas")
|
|
|
parser.add_argument("-y", "--height", type = int, default = 200,
|
|
|
help = "the height of canvas")
|
|
|
+ parser.add_argument("-r", "--prefer-horizontal", type = float,
|
|
|
+ default = 0.9,
|
|
|
+ help = "the ratio of times to try horizontal fitting")
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
if not args.jobs is None:
|
|
@@ -84,12 +87,14 @@ def main():
|
|
|
img = Image.open(args.mask).resize((args.width, args.height))
|
|
|
mask = np.array(img)
|
|
|
|
|
|
- wc = WordCloud(font_path = args.fontpath,
|
|
|
+ wordcloud = WordCloud(font_path = args.fontpath,
|
|
|
mask = mask,
|
|
|
contour_width = args.contour,
|
|
|
contour_color = "steelblue",
|
|
|
width = args.width,
|
|
|
- height = args.height).generate_from_frequencies(c)
|
|
|
+ height = args.height,
|
|
|
+ prefer_horizontal = args.prefer_horizontal)
|
|
|
+ wc = wordcloud.generate_from_frequencies(c)
|
|
|
wc.to_image().save(args.output)
|
|
|
|
|
|
if __name__ == "__main__":
|