Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from collections import defaultdict
- import re
- import numpy as np
- c=0
- f = open('/Users/Half_Pint_Boy/Desktop/sentenses.txt', 'r')
- for line in f:
- c = c + 1
- word_positions = {}
- with open('/Users/Half_Pint_Boy/Desktop/sentenses.txt', 'r') as f:
- index = 0
- for word in re.findall(r'[a-z]+', f.read().lower()):
- if word not in word_positions:
- word_positions[word] = index
- index += 1
- print(word_positions)
- matrix=np.zeros(c,index)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement