aks1981 commited on
Commit
d90b2bb
·
verified ·
1 Parent(s): a8856f7

Create tokenization.py

Browse files
Files changed (1) hide show
  1. tokenization.py +20 -0
tokenization.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+
4
+ from urllib.request import urlopen
5
+ from bs4 import BeautifulSoup
6
+
7
+ url = "https://raw.githubusercontent.com/cltk/hindi_text_ltrc/master/tulasidaas/Raamacharita_maanasa/1/main.txt"
8
+ html = urlopen(url).read()
9
+ soup = BeautifulSoup(html, features="html.parser")
10
+
11
+ # kill all script and style elements
12
+ for script in soup(["script", "style"]):
13
+ script.extract() # rip it out
14
+
15
+ # get text
16
+ text = soup.get_text()
17
+ ramayana_text = text
18
+ print(type(text))
19
+
20
+