Created
June 18, 2014 16:34
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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