合并标签 - 标签同义词

有两种方式可以表达与 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 个赞

Here’s a preview of what I’ve got so far.

I’d like to add a bit more to the tag info section, like which categories it’s restricted to (if any), and which tag groups it belongs to (if “tags listed by group” setting is enabled).

Adding tag descriptions has been requested, so this info section will be where it will be seen and changed.

19 个赞

This is cool! Should the button be :wrench: Edit like it is for categories? and then should the settings also be in a modal?

7 个赞

The video is showing the admin view of the tag info, but it also works for anon and non-staff users. They will see the synonyms, categories where the tags can be used (if they’re restricted to some categories), and tag group names that they belong to (if tag group names are public on the /tags page).

That space is also ready for new features that have been requested, like being able to have descriptions for tags.

I kinda hate the modal approach now, especially since the category modal is so full and keeps growing. Maybe category settings need to be moved out of a modal.

7 个赞

Yeah that makes sense, I definitely prefer on-page to modal but I’d rather be consistent either way. Updating the category settings to be more like the layout for group settings might be a good move at some point.

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 个赞