Skip to content

Commit

Permalink
fix bug parsing replace_numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
Mehrad0711 committed May 6, 2020
1 parent beb1e82 commit b2c3072
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/replace_parameters.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ module.exports = class ParameterReplacer {
}
if (slot.type.isLocation && !this._replaceLocations)
continue;
if ( (slot.type.isNumber || slot.type.type==='tt:phone_number') && !this._replaceNumbers)
if ((slot.type.isNumber || slot.type.type==='tt:phone_number') && !this._replaceNumbers)
continue;

if (isReplaceType(slot.type)) {
Expand Down
14 changes: 7 additions & 7 deletions test/cmdline.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ export TMPDIR=$srcdir
workdir=`mktemp -d $TMPDIR/genie-XXXXXX`
workdir=`realpath $workdir`

on_error() {
rm -fr $workdir
}
trap on_error ERR INT TERM
#on_error() {
# rm -fr $workdir
#}
#trap on_error ERR INT TERM

oldpwd=`pwd`
cd $workdir
Expand All @@ -28,15 +28,15 @@ node $srcdir/tool/genie.js --help
node $srcdir/tool/genie.js requote $srcdir/test/data/en-US/samples-en-hard.tsv --output ./samples-en-hard-requoted.tsv --mode replace
diff -u $srcdir/test/data/en-US/samples-en-hard-requoted.tsv ./samples-en-hard-requoted.tsv
# qpis mode
node $srcdir/tool/genie.js requote $srcdir/test/data/en-US/samples-en-hard.tsv --output ./samples-en-hard-qpis.tsv --mode qpis --requote-numbers
node $srcdir/tool/genie.js requote $srcdir/test/data/en-US/samples-en-hard.tsv --output ./samples-en-hard-qpis.tsv --mode qpis
diff -u $srcdir/test/data/en-US/samples-en-hard-qpis.tsv ./samples-en-hard-qpis.tsv


## test augment.js and requote.js
# first augment input dataset
node $srcdir/tool/genie.js augment $srcdir/test/data/fa/para-restaurants-fixed.tsv --output ./para-restaurants-aug.tsv --random-seed 123 -l en-US --param-local fa --replace-numbers --thingpedia $srcdir/data/fa/restaurants/schema.tt --parameter-datasets $srcdir/data/fa/restaurants/parameter-datasets.tsv --synthetic-expand-factor 1 --quoted-paraphrasing-expand-factor 1 --no-quote-paraphrasing-expand-factor 1 --quoted-fraction 0.0 --debug
node $srcdir/tool/genie.js augment $srcdir/test/data/fa/para-restaurants-fixed.tsv --output ./para-restaurants-aug.tsv --random-seed 123 -l en-US --param-local fa --thingpedia $srcdir/data/fa/restaurants/schema.tt --parameter-datasets $srcdir/data/fa/restaurants/parameter-datasets.tsv --synthetic-expand-factor 1 --quoted-paraphrasing-expand-factor 1 --no-quote-paraphrasing-expand-factor 1 --quoted-fraction 0.0 --debug
# then requote the augmented dataset and assert the result matches the input dataset
node $srcdir/tool/genie.js requote ./para-restaurants-aug.tsv --output ./para-restaurants-aug-req.tsv --mode replace --requote-numbers
node $srcdir/tool/genie.js requote ./para-restaurants-aug.tsv --output ./para-restaurants-aug-req.tsv --mode replace
diff -u --left-column <(cut -f2- ./para-restaurants-aug-req.tsv) <(cut -f2- $srcdir/test/data/fa/para-restaurants-fixed.tsv)


Expand Down
2 changes: 1 addition & 1 deletion tool/workers/augment-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports = async function worker(args, shard) {
noQuoteExpandFactor: args.no_quote_paraphrasing_expand_factor,
singleDeviceExpandFactor: args.single_device_expand_factor,
replaceLocations: args.replace_locations,
replaceNumbers: args.replaceNumbers,
replaceNumbers: args.replace_numbers,
cleanParameters: args.clean_parameters
});
};
Expand Down

0 comments on commit b2c3072

Please sign in to comment.