-
-
Save moubaba/312ecf51b9dd5eb4f5db51da256c4ba7 to your computer and use it in GitHub Desktop.
This file contains 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
text_stems_sid,text_lems_sid = process_data(" ".join(homer_data.split(".")[10:13])) | |
vocab = list(set(text_stems_sid)) | |
print(" ".join(homer_data.split(".")[10:13])) |
This file contains 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
homer_response = requests.get("https://www.gutenberg.org/files/52927/52927-0.txt") | |
homer_data = homer_response.text | |
homer_data = homer_data.split("***")[2] |
This file contains 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
stems,lems = process_data(homer_data.split(".")[12]) | |
print(homer_data.split(".")[12]) | |
onehot_encoded = list() | |
for word in stems: | |
letter = [0 for _ in range(len(set(text_stems_sid)))] | |
print(word,vocab.index(word)) | |
letter[vocab.index(word)] = 1 | |
onehot_encoded.append(letter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment