Concordance Plus Context & Links?

I am not very confident that this can be done, (but as my Father used to say, “The worst anyone can say is ‘No’” :wink: ). I have been using the script by Korm found here, search.php?keywords=concordance&terms=all&author=&fid%5B%5D=31&sc=1&sf=all&sr=posts&sk=t&sd=d&st=0&ch=300&t=0&submit=Search, for some time which makes a good job of producing a concordance of any document and I would like to go further and have:

(1) The ability to make a concordance of any document and see the words in context much like, for example, the Bible concordances that can be purchased in book form.
(2) Have ‘hot links’ to the entry selected.

The end result might look something like this:

The best database is DevonThink Pro and it can be found at
I would seriously advise DevonThink for any student

I realize that this is a big ask and may well be impossible to do apart from a completely new app!

Any genius out there know how to do this?

Well, that’s not exactly the “AppleScript greater than which no AppleScript can be conceived”, but it is a large job. Consider this – you probably don’t really want a concordance with context and links that includes every word in every document in your selection. Does it matter what the context is for "a’, “the”, “these”, “uh”? So, you would want to initiate the context-concordance with a list of words. An app cannot do that – it would be data you input. Then, do you really need every context? You don’t need to find and report “world” in every header or footer – so the program would have to have the smarts to decide what contexts matter, and, more difficult, decide that this context is one of those that doesn’t matter. (It’s not easy to inspect raw text and decide that it is a header or a footer, for example – there are worse cases to grapple with). Then, there are the raw limitations of DEVONthink’s scripting dictionary – context is not available for any of the results of the commands that the existing “concordance” and “search” scripts use. So, brute force is needed to examine every text item in every document in the selection. Finally, only certain kinds of documents actually have workable text data – text, RTF, HTML, XML, Formatted Text, and Markdown (PDF text is always iffy, Office documents are a bear) – so consequentially the results of this context-conconcordance will always be less than 100% accurate, and possibly so inaccurate as to be useless. :open_mouth:

Not that it cannot be done. :slight_smile:

Thanks Korm for your reply. Having considered well your reply I think it is a case of, as my father also used to say, “It’s not worth the candle”! But thanks anyway :smiley: