Another strange idea: auto-tagging.
Demo:
(1) I have about 50 tags in this groups. I have setup two custom md fields “ATagOr” and “ATagAnd”. Auto-tagging happens when name OR aliases OR any word in “ATagOr” is found in the document AND conditional to the existence of words in “ATagAnd”. There are two tags that have the setup. All my tags are prefixed and have no aliases, therefore won’t find a match in the document. If the name or aliases of your tags are actual word/s, they will be used to find a match in the doc.
(2) A document, no tag is assigned. Run the button “AutoTag POC”.
(3) The document is tagged. Any additional word or phrase can be added to the two fields of any tag at anytime (separate by comma AND no space before or after the comma). So, ur auto-tagging is organic in an “human-intelligence” manner.
Before showing the very primitive proof-of-concept script:
Disclaimer:
(1) Disclaimer: I believe that the concept of auto-tagging is more applicable to one or few items and to items with small amount of text at each activation (snippets of text, bills, pdf<20pages, etc). Because it is very difficulty to control the quality of auto tag-assignments to a large number of items or items with many words. Perhaps, the best application of auto-tagging is to classify an item when it’s in the inbox, or a project item, or a literature that is just downloaded. So, this script is designed for one or very few item. I hope I’ll be able to do this in one/few Items-focused tagging Some questions on concordance and one question on custom meta data.
(2) You can’t use this script unless (a) you have setup the two fields mentioned-above (datatype: multiline text) AND, (b) each field must have at least an empty space " " within (use batch process to do it). The reason for (b) is because custom metadata field can’t be assessed by script unless it has something inside (such as " "). I have no coding for any exception/error scenario in the script, and this script only handles the immediate level children of a tag group.
(3) Once again, the DT3 dictionary is really comprehensive for doing almost anything. Those who know shell script for unix command will be able to develop a much more powerful conditional auto-tagging under this concept.
(4) Smart rule and smart group can achieve the same results AND can perform tag assignment with much more advance predicates. But this one is cleaner (no bunch of rules and groups), and perhaps may encourage more ad hoc adjustment of criteria (u will know which tags to add/change the criteria immediately after the wrong or missed-assignment and there is no need to search/remember which smart rule/group you have included the search words), and it’s fun. EDITED: smart rule/group are doing exactly what they are meant for: dealing with large number of items.
The script:
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
-- Ngan 2019.08.23
property topTagGpLoc : "/Tags/S.Subject Test"
property mdTagOR : "mdtagor" -- data type is single line text
property mdTagAND : "mdtagand" -- data type is single line text
tell application id "DNtp"
set theDocs to content record of think window 1
set theConList to get concordance of record theDocs
set cTagGp to get record at topTagGpLoc
set theTags to (children of cTagGp whose tag type is ordinary tag)
set autoTag to {}
repeat with eachTag in theTags
set theTagKMD to the custom meta data of eachTag
set tlOR to {name of eachTag} & {aliases of eachTag} & my strToList(mdTagOR of theTagKMD, ",")
set tlAND to my strToList(mdTagAND of theTagKMD, ",")
repeat with eachWordOR in tlOR
if tlAND is {" "} then
if theConList contains eachWordOR then set end of autoTag to eachTag's name
else
repeat with eachWordAND in tlAND
if (theConList contains eachWordOR) and (theConList contains eachWordAND) then set end of autoTag to (name of eachTag)
end repeat
end if
end repeat
end repeat
if autoTag is not {} then set tags of theDocs to (tags of theDocs ) & autoTag
end tell
on strToList(thestr, d)
local theList
set {tid, text item delimiters} to {text item delimiters, d}
set theList to every text item of thestr
set text item delimiters to tid
return theList
end strToList