Skip to content

Commit

Permalink
Fixing argument parser and adding validation
Browse files Browse the repository at this point in the history
  • Loading branch information
brunobastosg committed Sep 10, 2020
1 parent 9d32ae9 commit 2fe06d7
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions code/augment.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,27 @@

#how much to replace each word by synonyms
alpha_sr = 0.1#default
if args.alpha_sr:
if args.alpha_sr is not None:
alpha_sr = args.alpha_sr

#how much to insert new words that are synonyms
alpha_ri = 0.1#default
if args.alpha_ri:
if args.alpha_ri is not None:
alpha_ri = args.alpha_ri

#how much to swap words
alpha_rs = 0.1#default
if args.alpha_rs:
if args.alpha_rs is not None:
alpha_rs = args.alpha_rs

#how much to delete words
alpha_rd = 0.1#default
if args.alpha_rd:
if args.alpha_rd is not None:
alpha_rd = args.alpha_rd

if alpha_sr == alpha_ri == alpha_rs == alpha_rd == 0:
ap.error('At least one alpha should be greater than zero')

#generate more data with standard augmentation
def gen_eda(train_orig, output_file, alpha_sr, alpha_ri, alpha_rs, alpha_rd, num_aug=9):

Expand Down

0 comments on commit 2fe06d7

Please sign in to comment.