Coder Social home page Coder Social logo

stagger's Introduction

Stagger

Stagger Icon

The Stupid Tagger for DEVONthink Pro (2)1.

Stagger looks at the selected piece of content and tries to suggest groups in your hierarchy in which to classify it.

It does not, in any way, aim to replicate the smart AI of DEVONtechnologies; it simply matches strings against Group names it finds. It only looks at leaf node groups, and does not learn (or even attempt to learn) about your hierarchy or content.

What it does do is suggest as many matching tags as it can in one fell swoop, and will tag against as many as you want. This will effectively replicate the item into multiple locations at once. This can help manage a structured hierarchy of tags, and ease the paralysis of putting content in place based around a known taxonomy.

It's up to you to establish and build that taxonomy, however. This will dictate the effectiveness of this tool.

Is the tagger stupid, the usage stupid, or the idea stupid? ONLY YOU CAN DECIDE.

Why this exists.

Always a good opening question. Why does this exists? It's to answer a particular requirement I had in DEVONthink, which this fits perfectly. It may not fit how you use DEVONthink at all, and may well make a pig's ear of your existing data structures. This may also may be perceived as an insult to the fine engineers at DEVONthink and their AI systems, and may be a toy-like joke to the people developing Open Calais2. No matter; this does what it does, and as you can see from the fact you can download the code and change it on your own computer, it actually is open.

This scrapes a piece of content you have open in DEVONthink Pro, and looks for groups you have that may match strings in the text. It suggests some of those groups in a pop-up window, and the items you select (or the items you don't deselect) it then assigns to that item as a tag.

Following the 'Conventions to be of use', this can be used to assign simple ontologies or taxonomies of tags against items quickly and easily, saving you from developing ugly and inflexible tagging patterns - which are useful in and of themselves in parallel with this.

This is useful if you have a group hierarchy of

  • Companies
    • Organised by sector * Whose Names become Leaf Nodes
      • And are groups you may want to classify items into
  • People
    • Organised by activities
      • Whose names become Leaf Nodes

...or any similar hierarchical group structures for which you may want to classify items into, and whose hierarchies are set in DEVONthink.

Personally, I use this to quickly assign the author of a piece to their relevant folder, as well as companies and organisations listed in a piece of content.

The use of concrete tags, rather than full-text search, makes this a particularly useful assistant alongside Ammonite, which presents a tag soup and allows you to whittle down (or have suggestions) of related tags. It's another way of exposing relationships and patterns in your database which may or may not appeal to certain users, and may or may not appeal to the developers of DEVONthink.

Conventions to be of use.

  1. You're running macOS High Sierra (10.13); older versions of macOS may work, but are untested.
  2. You're using DEVONthink Pro (2).
  3. Your database does not exclude Groups from Tagging. (you can check this by looking at the menu FileDatabase PropertiesYour Database Name)
    How to tell if your database allows Groups to be Tagged
  4. You have a hierarchical tree of Groups who are set to Exclude from Classification and whose names begin with Capital Letters or numbers, and are likely to be found in the texts you wish to auto-classify.
    A hierarchy of Groups with Exclude from Tagging set

Installation

Download the stagger.scpt and stick it somewhere.

If you place it in ~/Library/Application Support/DEVONthink Pro 2/Scripts, it will appear in your DEVONthink Pro 2 menu. If you place it in ~/Library/Application Support/DEVONthink Pro 2/Scripts/Toolbar, heaven forbid, you can use it when you you customise the toolbar in DEVONthink Pro 2.

Usage

  1. Invoke Stagger, either through the scripts menu, the toolbar icon you added, or by running it from the finder (or your application launcher of preference).
  2. The first time it runs, it will build an index of your groups - this can be a time consuming process, so Stagger caches it to disk as a preferences file.
  3. A window appears with matching terms highlighted. ⌘-click Groups you wish to deselect, or click then ⌘-click extra items to replace the selection.
    The Stagger window in action
  4. Click 'Cancel' to abort or 'OK' to confirm.
  5. The selected tags will be assigned to the item in DEVONthink, along with the parent items of those groups - this will allow you to assign the hierarchy from your Group Taxonomy at once.
  6. You'll know it's worked as you should see one or more grey tag items appear at the bottom of your content (if the tag viewer is open - press ⌃⌥⌘T to toggle the tag display)

Electronic Ephemera

Stagger will cache your tags the first time it is run - this is stored in a settings file called com.davemee.stagger.

If you wish to remove this record, or force Stagger to rebuild next time it is launched, enter the following at the terminal:

defaults delete com.davemee.stagger tags

It is advised to run this after making any changes to your Group hierarchy, as Stagger will not pick this up automatically.

Future Plans

  1. Automatic re-building of tag caches
  2. Supplementary stamping with an 'autotagged by Stagger' tag (to make it easy to find and review Stagger tagged items)
  3. Better matching and recognition of tags

Please! Help!

Suggestions, code fixes, patches, complete rewrites all welcome. Really, they are - I have no idea what I'm doing, but it seems to work. Fork, push request, or just email.

Credits

Hacked together by Dave Mee, August 2017. Email the author at [email protected]3.

If this saves you some trouble, and you wish to make a contribution, consider making a donation to a local animal welfare or vegan charity, or consider undertaking a few days of a meat, fish and dairy free diet.

Icon by Nikin  distributed through Pixabay and used under their graceful adoption of a Creative Commons license.

The Actual Hard Bits of Code

This project would not have been possible without the help of a few people on the DEVONthink forums - where you can pretty much watch the evolution of this script play out, including the wild and esoteric mis-steps.

Mad JavaScript and JXA skills via the god-like Houthakker and ... well, he's not said don't distribute the good bits of this script.

Other suggestions and pointers - particularly the if-I-knew-then-what-I-know-now lessons about AppleScript courtesy of BLUEFROG, a sage and wisened Automation adviser.

Final thanks to cgrunenberg who said it would be easy. When Houthakker and BLUEFROG wrote all the code, it was.

Warranty

No warranty whatsoever - If it doesn't do what you expect it to, fix it, flag it, or stop using it. The description of the software is a description of how it is intended to operate, and guarantees cannot be made for how it will work under all circumstances, systems, and computers. You are free to inspect the code before usage, and as ever, making a backup of your data before running it the first time is advisable. With this said, it only uses public interfaces provided by macOS and DEVONthink Pro, and only adds tags, and saves a JSON text file to disk.


Version 1.0.01, 2017-10-10 13:44

Footnotes

  1. http://www.devontechnologies.com/products/devonthink/devonthink-pro.html

  2. http://www.opencalais.com

  3. This is not an endorsement of Google, Alphabet or their business practices.

stagger's People

Contributors

davemee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.