Taggers are particularly useful to agents. Often, an agent needs to look for significant or interesting terms in the text:
query: $Text.icontains("Caesar") |$Text.icontains("Cato") …
In projects that have lots of text, these agents have a difficult task: each clause might need to search all the text in the document, and each clause needs to build a regular expression matcher. The tagger is more restricted—it searches only for entire words, not for regular expressions—but it is significantly faster and it runs only when the text of the notes changes. In the example above, we could replace the query with the simpler query
query: $NLTags.contains("Rome")
and add a single line to the $Text of the /Hints/Taggers/NLTags note:
Rome: Caesar; Cato; Cicero; Aggripa; Brutus; Decius; Catullus
Now, the agent needs only to examine set $NLTags, which requires far less work than searching all the text of a large document.