Created
          February 9, 2017 23:00 
        
      - 
      
- 
        Save Smerity/34e57f258cea48dba4c93d2261fc9330 to your computer and use it in GitHub Desktop. 
    Count the number of unique tokens in WikiText-2 and/or WikiText-103
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | vocab = set() | |
| for i, line in enumerate(open('wiki.train.tokens')): | |
| words = [x for x in line.split(' ') if x] | |
| [vocab.add(word) for word in words] | |
| if i < 10: print(words) | |
| print('Vocab size:', len(vocab)) | |
| # Returns 33,278 for WikiText-2 | |
| # Returns 267,735 for WikiText-103 | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment