Repository: espnet/espnet

Issue:
merge_json behavior when no labels.
@kamo-naoyuki, I've found that there is a case when we don't have any label output in some utterances for the switchboard evaluation data (`rt03`). But current `data2json.sh` cannot allow such cases 
https://github.com/espnet/espnet/blob/master/utils/merge_scp2json.py#L210-L214
Can you relax this?
This check is good for the training data, but it excludes such utterances in the evaluation set, and makes the evaluation different from other benchmarks.


Discussion:

Resolving patch:
diff --git a/espnet/bin/asr_recog.py b/espnet/bin/asr_recog.py
--- a/espnet/bin/asr_recog.py
+++ b/espnet/bin/asr_recog.py
@@ -112,6 +112,11 @@ def main(args):
     np.random.seed(args.seed)
     logging.info('set random seed = %d' % args.seed)
 
+    # validate rnn options
+    if args.rnnlm is not None and args.word_rnnlm is not None:
+        logging.error("It seems that both --rnnlm and --word-rnnlm are specified. Please use either option.")
+        sys.exit(1)
+
     # recog
     logging.info('backend = ' + args.backend)
     if args.num_spkrs == 1:
diff --git a/utils/merge_scp2json.py b/utils/merge_scp2json.py
--- a/utils/merge_scp2json.py
+++ b/utils/merge_scp2json.py
@@ -6,6 +6,7 @@
 
 import argparse
 import codecs
+from distutils.util import strtobool
 from io import open
 import json
 import logging
@@ -58,6 +59,9 @@ def shape(x):
                         help='The json files except for the input and outputs')
     parser.add_argument('--verbose', '-V', default=1, type=int,
                         help='Verbose option')
+    parser.add_argument('--allow-one-column', type=strtobool, default=False,
+                        help='Allow one column in input scp files. '
+                             'In this case, the value will be empty string.')
     parser.add_argument('--out', '-O', type=str,
                         help='The output filename. '
                              'If omitted, then output to sys.stdout')
@@ -162,7 +166,7 @@ def shape(x):
         for ls_list in (input_lines, output_lines, lines):
             for ls in ls_list:
                 for line in ls:
-                    if line == ''or first == '':
+                    if line == '' or first == '':
                         if line != first:
                             concat = sum(
                                 input_infos + output_infos + infos, [])
@@ -208,11 +212,16 @@ def shape(x):
                 for line, info in zip(line_list, info_list):
                     sps = line.split(None, 1)
                     if len(sps) < 2:
-                        raise RuntimeError(
-                            'Format error {}th line in {}: '
-                            ' Expecting "<key> <value>":\n>>> {}'
-                            .format(nutt, info[1], line))
-                    uttid, value = sps
+                        if not args.allow_one_column:
+                            raise RuntimeError(
+                                'Format error {}th line in {}: '
+                                ' Expecting "<key> <value>":\n>>> {}'
+                                .format(nutt, info[1], line))
+                        uttid = sps[0]
+                        value = ''
+                    else:
+                        uttid, value = sps
+
                     key = info[0]
                     type_func = info[2]
                     value = value.rstrip()


Test patch: