Jump to content
smarg19

Parsers: Greek and Latin parser for Alfred

Recommended Posts

Parsers

Greek and Latin parsers for Alfred

Version: 2.0

Download at Packal

This is a somewhat specialized workflow, but for those who read Greek and Latin, it will likely prove beneficial. This workflow uses the Perseus parsing backend to allow full parsing of both Greek and Latin terms. Simply use the keyword parse followed by the unknown Greek or Latin word. Parsers will automatically fetch all of the parsing data from Perseus, munch it up, and offer you all of the possible parsings via Alfred's elegant UI.

alfred_parser.png

If you would like a bit more information, Parsers adds two actions for any selected parsing. Using cmd+return, you can view a HUD of the parsing data chosen, pretty printed, and have that data copied to the clipboard.

Greek: greek_parse.png

Latin: latin_parse.png

Alternatively, you can use shift+return to view a HUD of the lexicon entry for that parsing term, and this lexicon data will also be copied to the clipboard (NOTE: Parsers will attempt to display the lexicon entry from the most concise lexicon available for the chosen term).

Greek: greek_lexicon.png

Latin: latin_lexicon.png

Let me know if you have any further feature suggestions. And enjoy your Greek and Latin,

stephen

Edited by smarg19

Share this post


Link to post

UPDATE: I have just pushed version 2.0 to Packal. This is a total rewrite, but it keeps the essential UI. Use a keyboard shortcut or the Script Filter to get parsing options. Then, either [1] directly copy that parsing info, [2] copy a nicely formatted version of the parsing info, or [3] (this is the newest part) look up that lemma in a lexicon.

The lexicon lookup with show a webview with a cleaned-up, well-formatted version of the lexicon entry. This text is selectable and copyable, and is much easier to read than on Perseus' website.

This is a great update. Hope you like it,

stephen

Share this post


Link to post

Thanks for sharing this interesting workflow. However, i get an error when I try to run it: 'nonetype' object is not iterable. I'm running Yosemite, maybe that's why? Incidentally, when I first run it, I was asked to authorize something (sorry but I don't remember what exactly) to always run. Is that normal? Thank you!

Share this post


Link to post

Can you run the workflow with Alfred's debugger on, and then post the debugger output? I need specific line numbers and such. Also, the authorization was to download a dependency. I'm using an early version of a workflow utility to allow workflows to download utilities at runtime, instead of bundling them all with the workflow. This reduces the size of the workflow itself, and thus alleviates user's Dropboxes (if they are syncing).

Share this post


Link to post

Thank you so much for the prompt reply. Here goes, enjoy:

 

Starting debug for 'Parsers'

 
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 15:48:13 parser.py:369 DEBUG    {u'<argument>': u'noun sg masc nom',
 u'<flag>': u'lexica',
 u'display': False,
 u'launch': True,
 u'search': False}
15:48:13 parser.py:104 DEBUG    Running launch_codepath...
15:48:13 workflow.py:1832 ERROR    'NoneType' object is not iterable
Traceback (most recent call last):
  File "/Users/*/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.FF230D30-ADBD-480A-A904-7448BCD6D718/workflow/workflow.py", line 1830, in run
    func(self)
  File "parser.py", line 371, in main
    res = pd.run(args)
  File "parser.py", line 107, in run
    return method()
  File "parser.py", line 359, in launch_codepath
    self.log_vocab(self._chosen_item())
  File "parser.py", line 263, in _chosen_item
    for item in parsing_data
TypeError: 'NoneType' object is not iterable
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 15:48:13 parser.py:369 DEBUG    {u'<argument>': u'noun sg masc nom',
 u'<flag>': u'lexica',
 u'display': False,
 u'launch': True,
 u'search': False}
15:48:13 parser.py:104 DEBUG    Running launch_codepath...
15:48:13 workflow.py:1832 ERROR    'NoneType' object is not iterable
Traceback (most recent call last):
  File "/Users/*/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.FF230D30-ADBD-480A-A904-7448BCD6D718/workflow/workflow.py", line 1830, in run
    func(self)
  File "parser.py", line 371, in main
    res = pd.run(args)
  File "parser.py", line 107, in run
    return method()
  File "parser.py", line 359, in launch_codepath
    self.log_vocab(self._chosen_item())
  File "parser.py", line 263, in _chosen_item
    for item in parsing_data
TypeError: 'NoneType' object is not iterable
[ERROR: alfred.workflow.input.scriptfilter] Code 1: 15:48:13 parser.py:369 DEBUG    {u'<argument>': u'noun sg masc nom',
 u'<flag>': u'lexica',
 u'display': False,
 u'launch': True,
 u'search': False}
15:48:13 parser.py:104 DEBUG    Running launch_codepath...
15:48:13 workflow.py:1832 ERROR    'NoneType' object is not iterable
Traceback (most recent call last):
  File "/Users/*/Library/Application Support/Alfred 2/Alfred.alfredpreferences/workflows/user.workflow.FF230D30-ADBD-480A-A904-7448BCD6D718/workflow/workflow.py", line 1830, in run
    func(self)
  File "parser.py", line 371, in main
    res = pd.run(args)
  File "parser.py", line 107, in run
    return method()
  File "parser.py", line 359, in launch_codepath
    self.log_vocab(self._chosen_item())
  File "parser.py", line 263, in _chosen_item
    for item in parsing_data
TypeError: 'NoneType' object is not iterable

Share this post


Link to post

Damn. If I had a nickel everytime I made that error, I'd probably have a dollar. I accidentally hardcoded the arguments for the workflow in the script file.

But, it's an easy fix. I've just uploaded version 2.1 to Packal. Download the new version and give it a whirl :)

Share this post


Link to post

Thank you for this fantastic Workflow. In my case however it works only partially. The query is parsed in Alfred in the actions' window, but I cannot get Alfred to display anything in this dark big HUD through ⌘⏎ or ⇧⏎.

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...