合并标签 - 标签同义词

有两种方式可以表达与 Bangalore 城市(也称为 Bengaluru)相同的内容。

由于此主题同时包含这两个标签。

有什么方法可以合并这些标签,并设置一个主标签,其他标签作为同义词,如下文所述吗?

Discourse 是否支持此功能?

14 个赞

I do not believe so at the moment - each tag is unique.

A not very beautiful workaround you could do is enforce one spelling/synonym by making the others staff-tags (so most users can’t use them). You can then either not use the different spellings /synonyms at all or just have one topic for each which is just a post redirecting to the other tag.

2 个赞

At some point we will be forced to implement tag synonyms @neil it is inevitable. Also a problem with plurals. We went through this same thing at Stack Overflow…

20 个赞

@codinghorror Any guidance on if this is upcoming soon or still a ways out? Thinking through how to overhaul tagging as we’re migrating from Vanilla and deciding whether to build our own internal systems for tag synonyms and merging (likely a manual process) or wait until it’s supported natively.

If you’re getting close, perhaps we’ll hold off. :slight_smile: Thanks!

3 个赞

I wouldn’t mind doing it, not sure how much work it would be though. Any idea on scope @neil? The classic example from my SO days is this one:

string vs. strings

Just making plurals remap to the singular version is a good starting point, though obviously you’d want {x} different forms to remap to the same base.

8 个赞

Thanks for the reply, @codinghorror! Automatic merging of singular vs. plural would be great.

One more thing that might be useful based on my experience is a new tags queue so it’s easy so spot them and either a) approve them as is b) merge them with something else or c) delete them.

One of the problems we have now is identifying newly added tags. Because they’re not anywhere unique it becomes a hunting game of pouring through a sea of words each month looking for similar words/phrases.

Having a new tag queue - or being able to sort tags by date added - would be immensely helpful for keeping things nicely organized. Or, at least selfishly, for us. :slight_smile:

7 个赞

We don’t have much of a UI for managing tags, since we only allow renaming and deleting currently. But merging and adding a list of synonyms doesn’t seem like much. Reviewing new tags would happen in the new review queue, so I’m not sure how much work that would be. So… a week or two of work?

10 个赞

I’ll add it to the 2.4 release list.

16 个赞

Fantastic, thanks @codinghorror and @neil!

3 个赞

以下是我目前完成的预览。

我希望在标签信息部分添加更多内容,例如它受限于哪些分类(如果有的话),以及它属于哪些标签组(如果启用了“按组列出标签”设置)。

添加标签描述的功能已被提出请求,因此该信息部分将是用户查看和修改这些内容的地方。

19 个赞

太棒了!按钮是否应该像分类那样显示为 :wrench: 编辑 ?另外,设置是否也应该放在模态框中?

7 个赞

该视频展示了标签信息的管理员视图,但匿名用户和非工作人员同样适用。他们将看到同义词、标签可使用的分类(如果限制在特定分类中),以及所属的标签组名称(如果标签组名称在 /tags 页面公开)。

该区域也已准备好支持已请求的新功能,例如为标签添加描述。

我现在有点讨厌模态框的方式,尤其是分类模态框已经非常拥挤且不断膨胀。也许分类设置需要移出模态框。

7 个赞

是的,这很有道理。我确实更喜欢页面内设置而非模态框,但无论如何保持一致性更好。将来将分类设置的布局更新得更像群组设置的布局,或许是个不错的举措。

5 个赞

此功能已包含在最新的测试版发布中,请升级并试用。

创建同义词和合并标签在同一个位置进行。如果您想合并“js”和“javascript”标签,并选择“javascript”作为基础标签,请前往 javascript 标签页面(/tags/javascript)。

一旦将“js”添加为同义词,其相关主题将显示为已标记为“javascript”。

在搜索和筛选中,“js”将显示并直接引导用户到“javascript”。标记主题时,使用“js”将自动替换为“javascript”。依此类推。我希望已涵盖所有需要同义词处理的场景,如果有任何遗漏,请告诉我。

15 个赞

这是一项很棒的工作 <3

编辑:我刚刚注意到,这也是重命名标签的非常流畅的方式。我们有 100 多个 ‘ux’ 标签,但论坛设置要求标签至少包含 3 个字母。我将 ‘ux’ 添加为 ‘ux-design’ 的同义词,我们所有的 ‘ux’ 标签都立即更新了。

6 个赞

重命名行为让我有点意外,这是个惊喜,但确实让人意外。如果同义词会导致大规模重命名,我们是否应该提示 @neil“您即将把 100 个带有标签 foo 的主题修改为标签 bar”之类的内容?不太确定,这确实有点让人意外。

5 个赞

嗯,我不明白这里有什么好惊讶的。难道你会想要同时保留两种说法吗?

以这个例子来说,在将“js”合并到“javascript”之后,让一些主题标记为“js”而另一些标记为“javascript”的用例是什么呢?我想,如果有一条消息解释一下“同义词”的含义,会很有帮助。

6 个赞

我绝对:heart: 标签同义词和这个管理它们的新界面——干得漂亮!

我想 Sam 提到的那种惊讶,我也感同身受:这是一个影响众多主题的强力工具。它当然是一件好事(tm),也是一个巨大的改进,但由于无法撤销(没有“撤销”功能,对吧?),可能会导致人们无意中做出日后会后悔的更改,而当时并未意识到。这可能有些过度,但如果能有一个提示,警告即将发生的更改范围,将会很有帮助。

7 个赞

我甚至都不用标签,但这看起来太棒了!关于潜在的惊喜,只要明确说明添加同义词 = 实际合并,可能会很有帮助。

对我来说,“同义词”可能意味着所有版本仍然会显示,只是在底层映射到同一个东西;我大概能想到一种情况,有人可能确实希望标签的规范版本是某个更长、更正式的形式,但仍然期望在显示时出现较短的同义词版本,诸如此类(不过我理解为什么你目前的实现方式更合理!)

2 个赞