~ubuntu-branches/ubuntu/vivid/sphinxtrain/vivid

« back to all changes in this revision

Viewing changes to src/programs/make_quests/parse_cmd_ln.c

  • Committer: Package Import Robot
  • Author(s): Samuel Thibault
  • Date: 2013-01-02 04:10:21 UTC
  • Revision ID: package-import@ubuntu.com-20130102041021-ynsizmz33fx02hea
Tags: upstream-1.0.8
ImportĀ upstreamĀ versionĀ 1.0.8

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ====================================================================
 
2
 * Copyright (c) 2004 Carnegie Mellon University.  All rights 
 
3
 * reserved.
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions
 
7
 * are met:
 
8
 *
 
9
 * 1. Redistributions of source code must retain the above copyright
 
10
 *    notice, this list of conditions and the following disclaimer. 
 
11
 *
 
12
 * 2. Redistributions in binary form must reproduce the above copyright
 
13
 *    notice, this list of conditions and the following disclaimer in
 
14
 *    the documentation and/or other materials provided with the
 
15
 *    distribution.
 
16
 *
 
17
 * This work was supported in part by funding from the Defense Advanced 
 
18
 * Research Projects Agency and the National Science Foundation of the 
 
19
 * United States of America, and the CMU Sphinx Speech Consortium.
 
20
 *
 
21
 * THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY ``AS IS'' AND 
 
22
 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
 
23
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 
24
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY
 
25
 * NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
26
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
 
27
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
 
28
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
 
29
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
 
30
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
 
31
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
32
 *
 
33
 * ====================================================================
 
34
 *
 
35
 */
 
36
/*********************************************************************
 
37
 *
 
38
 * File: cmd_ln.c
 
39
 * 
 
40
 * Description: 
 
41
 * 
 
42
 * Author: 
 
43
 * 
 
44
 *********************************************************************/
 
45
 
 
46
#include "parse_cmd_ln.h"
 
47
 
 
48
#include <sphinxbase/cmd_ln.h>
 
49
#include <sphinxbase/err.h>
 
50
 
 
51
#include <stdio.h>
 
52
#include <stdlib.h>
 
53
 
 
54
int
 
55
parse_cmd_ln(int argc, char *argv[])
 
56
{
 
57
  uint32      isHelp;
 
58
  uint32      isExample;
 
59
 
 
60
    const char helpstr[] =  
 
61
"Description: \n\
 
62
\n\
 
63
    This is an implementation of Dr. Rita Singh's automatic question \n\
 
64
    generation.  (Copied from Rita's comment) The current algorithm \n\
 
65
    clusters CI distributions using a hybrid bottom-up top-down \n\
 
66
    clustering algorithm to build linguistic questions for decision \n\
 
67
    trees.\n\
 
68
    (From Arthur : I need to do some tracing before understand it \n\
 
69
    what's the internal of the code)";
 
70
 
 
71
    const char examplestr[] =
 
72
"Example: \n\
 
73
make_quest -moddeffn mdef -meanfn mean -varfn var -mixwfn \n\
 
74
mixwfn -npermute 8 -niter 1 -qstperstt 20 -questfn \n\
 
75
questions -type .cont.";
 
76
 
 
77
 
 
78
    static arg_t defn[] = {
 
79
        { "-help",
 
80
          ARG_BOOLEAN,
 
81
          "no",
 
82
          "Shows the usage of the tool"},
 
83
 
 
84
        { "-example",
 
85
          ARG_BOOLEAN,
 
86
          "no",
 
87
          "Shows example of how to use the tool"},
 
88
 
 
89
        { "-moddeffn",
 
90
          ARG_STRING,
 
91
          NULL,
 
92
          "Model definition file of the ci models" },
 
93
 
 
94
        { "-meanfn",
 
95
          ARG_STRING,
 
96
          NULL,
 
97
          "means file for tree building using continuous HMMs" },
 
98
 
 
99
        { "-varfn",
 
100
          ARG_STRING,
 
101
          NULL,
 
102
          "variances file for tree building using continuous HMMs" },
 
103
 
 
104
        { "-fullvar",
 
105
          ARG_BOOLEAN,
 
106
          "no",
 
107
          "variances file contains full covariances" },
 
108
 
 
109
        { "-varfloor",
 
110
          ARG_FLOAT32,
 
111
          "1.0e-08",
 
112
          "The minimum variance"},
 
113
 
 
114
        { "-mixwfn",
 
115
          ARG_STRING,
 
116
          NULL,
 
117
          "PDF's for tree building using semicontinuous HMMs" },
 
118
 
 
119
        { "-npermute",
 
120
          ARG_INT32,
 
121
          "6",
 
122
          "The minimum variance"},
 
123
 
 
124
        { "-niter",
 
125
          ARG_INT32,
 
126
          "0",
 
127
          "Number of iterations"},
 
128
 
 
129
        { "-qstperstt",
 
130
          ARG_INT32,
 
131
          "8",
 
132
          "something per state"},
 
133
 
 
134
        { "-tempfn",
 
135
          ARG_STRING,
 
136
          "/tmp/TEMP.QUESTS",
 
137
          "(Obsolete) File to write temprorary results to " },
 
138
 
 
139
        { "-questfn",
 
140
          ARG_STRING,
 
141
          NULL,
 
142
          "File to write questions to" },
 
143
 
 
144
        { "-type",
 
145
          ARG_STRING,
 
146
          NULL,
 
147
          "HMM type" },
 
148
 
 
149
        {NULL, 0, NULL, NULL}
 
150
 
 
151
    };
 
152
 
 
153
    cmd_ln_parse(defn, argc, argv, 1);
 
154
 
 
155
    isHelp    = cmd_ln_int32("-help");
 
156
    isExample    = cmd_ln_int32("-example");
 
157
 
 
158
    if(isHelp){
 
159
      printf("%s\n\n",helpstr);
 
160
    }
 
161
 
 
162
    if(isExample){
 
163
      printf("%s\n\n",examplestr);
 
164
    }
 
165
 
 
166
    if(isHelp || isExample){
 
167
      E_INFO("User asked for help or example.\n");
 
168
      exit(0);
 
169
    }
 
170
 
 
171
 
 
172
    return 0;
 
173
}