Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make type of error rate optional. #193

Merged
merged 2 commits into from
Aug 9, 2017

Conversation

pkuyym
Copy link
Contributor

@pkuyym pkuyym commented Aug 9, 2017

No description provided.

@pkuyym pkuyym requested a review from xinghai-sun August 9, 2017 11:18
type=str,
help="There are total two error rate types including wer and cer. wer "
"represents for word error rate while cer for character error rate. "
"(default: %(default)s)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the wording concise, e.g. Error rate type for evaluation. 'wer' for word error rate and 'cer' for character error rate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

num_ins += 1
print("WER (%d/?) = %f" % (num_ins, wer_sum / num_ins))
print("Final WER (%d/%d) = %f" % (num_ins, num_ins, wer_sum / num_ins))
print("%s (%d/?) = %f" % \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove \

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

else:
error_rate_func = cer
error_rate_info = 'cer'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error_rate_func = cer if args.error_rate_type == 'cer' else wer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -136,7 +145,14 @@ def evaluate():
rnn_layer_size=args.rnn_layer_size,
pretrained_model_path=args.model_filepath)

wer_sum, num_ins = 0.0, 0
if args.error_rate_type == 'wer':
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

L148-L153 --> error_rate_func = cer if args.error_rate_type == 'cer' else wer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

num_ins += 1
print("WER (%d/?) = %f" % (num_ins, wer_sum / num_ins))
print("Final WER (%d/%d) = %f" % (num_ins, num_ins, wer_sum / num_ins))
print("%s (%d/?) = %f" % \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove error_rate_info and use print("Error rate [%s] ....." % args.error_rate_type) for simplicity ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Collaborator

@kuke kuke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@xinghai-sun xinghai-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@pkuyym pkuyym merged commit 7310baa into PaddlePaddle:develop Aug 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants