标签云网络服务?

4

是否有一个公共的免费网络服务可以生成标签云?我正在寻找类似于Google Chart这样的东西——输入URL,输出图像。


标签云不就是按频率大小排列的所有标签吗?一个 Web 服务如何帮助解决这个问题呢?如果我误解了您的意思,请原谅我的无知。 - John MacIntyre
5个回答

2

2
我觉得这个想法很有意义,但我还没有找到这样的服务。实际上,API可以是输入文字,输出样式文本或输入文字,输出图片。我将在SWT中实现我需要的内容,然后继续开发。您可以在http://www.wordle.net/gallery/wrdl/359579/JUnit_Tests上看到我想生成的东西的示例。这些是JUnit自测名称中的单词。

1

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.

Word Cloud API example

请注意,GET请求通常需要对文本进行URL编码,特别是如果它包含特殊字符。
有许多参数可以让您自定义和扩展您的词云。一些值得注意的参数包括:
- text: 实际要创建标签云的文本(必需) - scale: 确定单词按频率如何缩放的函数。linear(默认)、sqrt或log。 - removeStopWords: 设置为true以删除常见的英语单词 - fontScale: 确定单词基线大小的乘数
对于较大的文本,您应该使用POST请求而不是在URL中编码它。以下是Python中的示例用法:
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)

我记录了所有API选项和多个词云示例此处
希望有人觉得这很有用!

0

请注意这是一篇旧文章,但我认为tagcrowd.com可能适用于此处,尽管没有API访问权限。商业许可证很便宜$19.95。


0

Wordle许可证禁止嵌入和派生工作。否则,我很愿意使用它。它展示信息的方式非常美丽。 - Kent Beck

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接