18 lines
387 B
Python
18 lines
387 B
Python
import bs4 as bs
|
|
import urllib.request
|
|
import re
|
|
|
|
scraped_data = urllib.request.urlopen('https://en.wikipedia.org/wiki/Artificial_intelligence')
|
|
article = scraped_data.read()
|
|
|
|
parsed_article = bs.BeautifulSoup(article,'lxml')
|
|
|
|
paragraphs = parsed_article.find_all('p')
|
|
|
|
article_text = ""
|
|
|
|
for p in paragraphs:
|
|
article_text += p.text
|
|
|
|
sentence_list = nltk.sent_tokenize(article_text)
|