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?
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).
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.
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?
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.
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?..
@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
@syl solved this with definable auto-tagging in his Docus plugin. I suspect someone could pull that function out to create auto-tagging if he didn’t mind.
from my perspective the most obvious solution would be for a post to be auto-tagged with the tag(s) that the user is currently on (tag-page, or post). This makes it obvious visually to the user how the feature works if they need to change it, and in most cases it will probably be correct as they will be replying to something with the tags they are replying to.
I did. It just assigns a tag to every topic created in a category, but it’s a good start on something that could apply tags depending on topic content, I suppose.
+1 this would be a really useful feature or plugin, auto tagging based on watched words (each with an assigned tag) that exist in the topic (title/body).