Skip to content

Instantly share code, notes, and snippets.

@mtholder
Created June 18, 2014 16:34
Show Gist options
  • Save mtholder/fb8110613cea97baa37d to your computer and use it in GitHub Desktop.
Save mtholder/fb8110613cea97baa37d to your computer and use it in GitHub Desktop.
query taxomachine using contextQueryForNames. if a name is preceded by an arg that starts with -cblah, then blah will be the contextName
#!/usr/bin/env python
import sys
from peyotl.api.taxomachine import Taxomachine
taxomachine = Taxomachine()
from peyotl.nexson_syntax import write_as_json
context_name = 'All life'
for n in sys.argv[1:]:
if n.startswith('-c'):
context_name = n[2:]
else:
r = taxomachine.TNRS(n, context_name=context_name)
write_as_json(r, sys.stdout, indent=2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment