Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #section 1
- sentence = 'this is my sentence'
- answer = input(do you want to print your sentence? y/n)
- if answer == 'y' or 'yes':
- print(sentence)
- from ast import literal_eval
- with open('word_file.txt') as f:
- data = f.read().strip()
- words = ast.literal_eval(data)
- with open('pos_file.txt') as f:
- data = f.read().strip()
- pos = ast.literal_eval(data)
- result = " ".join([words[i-1] for i in pos])
- import ast
- with open('word_file.txt') as f:
- indivdual_words = ast.literal_eval(f.read())
- with open('pos_file.txt') as f:
- positions = ast.literal_eval(f.read())
- sentence = " ".join([indivdual_words[i-1] for i in positions])
- the cat sat on the cat mat
- word_list = []
- for word in w:
- wordlist.append(word)
- sentence = ''
- for index in n:
- word = wordlist[index]
- sentence+= word
- sentence+= ' '
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement