Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. # coding: utf-8
  2. import numpy as np
  3. import sys
  4.  
  5.  
  6. def domain_id(train_file, valid_file):
  7. train_set = np.load(train_file, encoding='latin1').tolist()
  8. valid_set = np.load(valid_file, encoding='latin1').tolist()
  9.  
  10. domain = {key: value for value, key in enumerate(np.unique([data['domain'] for data in train_set] + [data['domain'] for data in valid_set]))}
  11. print(domain)
  12.  
  13.  
  14. def main():
  15. # include here your dirs
  16. domain_id('./train.npy', './valid.npy')
  17.  
  18.  
  19. if __name__== "__main__":
  20. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement