julius_cli.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 # Copyright: Yuki Furuta <furushchev@jsk.imi.i.u-tokyo.ac.jp>
00004 
00005 
00006 from argparse import ArgumentParser
00007 import rospy
00008 from julius_ros.cli import register_isolated
00009 from julius_ros.cli import register_grammar
00010 
00011 
00012 if __name__ == '__main__':
00013     rospy.init_node("julius_cli")
00014 
00015     p = ArgumentParser()
00016     p.add_argument("-i", "--isolated", help="isolated word recognition",
00017                    action='store_true')
00018     p.add_argument("-n", "--name", help="name of grammar / vocabulary",
00019                    type=str)
00020     p.add_argument("path_or_words", nargs='+', type=str)
00021 
00022     print rospy.myargv()[1:]
00023 
00024     args = p.parse_args(rospy.myargv()[1:])
00025 
00026     print args
00027 
00028     if args.isolated:
00029         if len(args.path_or_words) < 1:
00030             p.error("Need at least one word to register")
00031         words = args.path_or_words
00032         register_isolated(args.name, words)
00033     else:
00034         if len(args.path_or_words) != 1:
00035             p.error("Only one path supported")
00036         path = args.path_or_words[0]
00037         register_grammar(args.name, path)


julius_ros
Author(s): Yuki Furuta
autogenerated on Sat Sep 9 2017 02:33:31