是否有一个公共的免费网络服务可以生成标签云?我正在寻找类似于Google Chart这样的东西——输入URL,输出图像。
是否有一个公共的免费网络服务可以生成标签云?我正在寻找类似于Google Chart这样的东西——输入URL,输出图像。
12年后,我决定建立这个词云API。您向它发送文本,它将根据频率渲染一个带有单词标记的PNG或SVG词云。
这里是一个简单的URL示例,使用一篇著名演讲:
https://quickchart.io/wordcloud?text=Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this.But, in a larger sense, we can not dedicate—we can not consecrate—we can not hallow—this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom—and that government of the people, by the people, for the people, shall not perish from the earth.
请注意,GET请求通常需要对文本进行URL编码,特别是如果它包含特殊字符。resp = requests.post('https://quickchart.io/wordcloud', json={
'format': 'png',
'width': 1000,
'height': 1000,
'fontScale': 15,
'scale': 'linear',
'removeStopwords': True,
'minWordLength': 4,
'text': 'To be or not to be, that is the question...',
})
with open('shakespeare.png', 'wb') as f:
f.write(resp.content)
请注意这是一篇旧文章,但我认为tagcrowd.com可能适用于此处,尽管没有API访问权限。商业许可证很便宜$19.95。
也许你可以用这个:http://www.wordle.net/