julius_cli.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3 # Copyright: Yuki Furuta <furushchev@jsk.imi.i.u-tokyo.ac.jp>
4 
5 
6 from argparse import ArgumentParser
7 import rospy
8 from julius_ros.cli import register_isolated
9 from julius_ros.cli import register_grammar
10 
11 
12 if __name__ == '__main__':
13  rospy.init_node("julius_cli")
14 
15  p = ArgumentParser()
16  p.add_argument("-i", "--isolated", help="isolated word recognition",
17  action='store_true')
18  p.add_argument("-n", "--name", help="name of grammar / vocabulary",
19  type=str)
20  p.add_argument("path_or_words", nargs='+', type=str)
21 
22  print(rospy.myargv()[1:])
23 
24  args = p.parse_args(rospy.myargv()[1:])
25 
26  print(args)
27 
28  if args.isolated:
29  if len(args.path_or_words) < 1:
30  p.error("Need at least one word to register")
31  words = args.path_or_words
32  register_isolated(args.name, words)
33  else:
34  if len(args.path_or_words) != 1:
35  p.error("Only one path supported")
36  path = args.path_or_words[0]
37  register_grammar(args.name, path)
def register_isolated(name, words)
Definition: cli.py:12
def register_grammar(name, path)
Definition: cli.py:28


julius_ros
Author(s): Yuki Furuta
autogenerated on Tue May 11 2021 02:55:36