Topic auto tagging

AI-generated summary

The discussion revolves around implementing an auto-tagging feature in Discourse. Janno_Liivak initially proposed a feature to automatically apply tags to topics based on keywords in the title. Falco suggested creating a plugin based on Sam’s Unhandled Tagger to achieve this.

Others contributed to the discussion, including scombs who proposed adding a “Default tags for this category” option to the Category>Edit>Tags screen. ChrisBeach suggested using a Bayesian algorithm to suggest tags, while Muiran shared a WordPress plugin that could be used as a reference.

krauss emphasized the importance of human validation in auto-tagging, suggesting a model where a robot suggests tags and a human confirms them. tophee proposed adding a “tag” action to watched words, which was later confirmed by neil as a feature that is closer to being implemented.

vinothkannans provided a simple code example for creating a plugin to auto-tag topics, while Andy02 suggested using a plugin with definable auto-tagging. pfaffman shared a plugin that assigns a tag to every topic created in a category, and Jagster raised concerns about the potential misuse of tags and the need for a more nuanced approach.

The discussion concluded with sam announcing that the auto-tagging feature is now implemented in the settings->customize->watched words->tag section.

I need one certain category’s (and it’s sub-category’s) to have auto-tagging feature. For example… I set up Tags, which can be used for topics in category (for example: iphone, macbookpro). If topic title has text “iPhone” and “MacBook Pro” in it, the tags “iphone” and “macbookpro” would be automatically selected for this topic.

What is the best strategy to get such feature implemented?

Should I go with a plugin? Is it possible to do with a plugin?

Or should I add feature to topic (and add “Topic auto-tagging” to it’s settings) and create a pull request to have it in main branch?

7개의 좋아요

Create a plugin based on Sam’s Unhandled Tagger.

Alter plugin.rb to scan for title and apply existing tags instead of always applying unhlandled.

9개의 좋아요

Instead of automatically tagging topics, I would like the idea of suggesting tags just as similar topics are suggested, but I imagine this isn’t that cheap to have (because we would need to maintain some sort of model/corpus per tag).

4개의 좋아요

What if tags would populate as you type and before posting you could add/remove tags? Would that be OK?

1개의 좋아요

Would like to see option on the Category>Edit>Tags screen for:

Default tags for this category

below the current options:

This would also help for topics posted via mobile since adding tags is not supported.

My use case is adding an “events” tag so that topics from different event subcategories across the site can get aggregated to one calendar.

1개의 좋아요

A bayesian algorithm would work well here.

To seed it, feed in all the current tagged posts, and let it learn which words in the content of a post correspond (probabilistically) to which tags.

1개의 좋아요

Merged in from a duplicate topic.

Great WP plugin and seems it would be a great Discourse plugin as well if built to the same logic as this one.

Comments?

4개의 좋아요

Yuss! I was hoping for something like this recently when I built a ‘homepage’ that relies on tagging to group content.

2개의 좋아요

See how Wikibots are working at Wikipedia, it is a good reference model… Other important criteria to policy and implementation:

  • to be an assisted agent: never (or very rare) an automatic classification with no human confirming it. Must work “by (assisted) lot” not in a continous (by demand) way.

  • to be specialized: never generic, need a scope and limited (configurable/controlable) range.

  • to be symmetric over validation: an human can be also use the same tag, the robot (software agent) is not the only autorithy to tagging its scope. So two cenarios: 1. robot tagging and human validating/confirming (or warning to vote). 2. human tagging, and robot valiating (or warning to other human confirm).

Whith this basic polices the robot is viable in any community!

Other suggestion: when the scope is specific, or when the “easy to tag” generates “tag pollution”, the best is to use different color to the tags of the bot-scope. EXAMPLE: tagging languages in a multilingual community as https://discuss.okfn.org.

1개의 좋아요

Now that we have watched words that trigger certain actions, wouldn’t it be easy to simply add “tag” as a possible action to perform upon a matched word/regex?

7개의 좋아요

It’s a feature that is closer to being implemented now, yes. “Simply adding tag” isn’t quite the whole story. Each watched word needs to also specify which tag to add, for example.

10개의 좋아요

That would be absolutely awesome! Especially if it’s not just words but also regular expressions. Auto-tagging based on regular expressions would bring tags in discourse to a whole new level!

Yes, and I also realize that the existing actions apply to posts while tags can only be applied to topics. So the question is: will tagging actions only be based on the first post? Or can any reply also trigger the tag? Or will it be a setting, whether it applies to both?..

Did anyone endup building this as a plugin?

@vinothkannans is currently working on something along these lines for PMs. I’m not sure how much extra work there would be to make it fit this brief – can you comment Vinoth?

You can create a plugin with the below simple code. But the difficulty level is fully depends upon your auto tagging logic/requirement.

DiscourseEvent.on(:topic_created) do |topic|
  guardian = Guardian.new(Discourse.system_user)
  DiscourseTagging.tag_topic_by_names(topic, guardian, ["bug"], append: true) if topic.title.match(/bug/)
end
13개의 좋아요

@syl 님은 Docus 플러그인에서 definable auto-tagging을 사용하여 이 문제를 해결했습니다. 그가 괜찮다면, 그 함수를 추출하여 자동 태그 기능을 만들 수 있을 것 같습니다.

제 관점에서 가장 명백한 해결책은 사용자가 현재 있는 태그 페이지(또는 게시물)의 태그로 게시물이 자동으로 태그되는 것입니다. 이렇게 하면 사용자가 기능을 변경해야 할 때 어떻게 작동하는지 시각적으로 명확해지고, 대부분의 경우 사용자가 해당 태그가 있는 게시물에 답글을 달고 있으므로 정확할 가능성이 높습니다.

2개의 좋아요

틀린 말이라면 정정해 주시겠지만, @pfaffman님이 이 플러그인을 https://github.com/pfaffman/discourse-topic-default-tag에 구현한 것으로 보입니다.

1개의 좋아요

그렇게 했습니다. 단순히 해당 카테고리에 생성된 모든 주제에 태그를 부여할 뿐이지만, 주제 내용에 따라 태그를 적용할 수 있는 기능의 출발점으로는 괜찮다고 생각합니다.

3개의 좋아요

+1. 주제(제목/본문)에 포함된 감시 단어(각 단어에 할당된 태그가 있는 경우)를 기반으로 자동 태그를 붙이는 기능이나 플러그인이 정말 유용할 것 같습니다.

1개의 좋아요

확실히 플러그인에서는 가능합니다. 위에서 언급한 제 플러그인을 출발점으로 삼거나 Marketplace 채널에서 질문해 보세요.

3개의 좋아요