Is it easy or hard to break up a sentence into words?
text = """
TIL that until earlier this year it was legal for apartments in Austin, Texas to have no windows, and that landlords often didn't disclose this in advertisements
https://theconversation.com/college-students-in-austin-texas-have-dwelled-in-windowless-rooms-for-years-heres-why-the-city-finally-decided-to-ban-them-228349
r/todayilearned - TIL that until earlier this year it was legal for apartments in Austin, Texas to have no windows, and that landlords often didn't disclose this in advertisements
"""
text.split()
['TIL', 'that', 'until', 'earlier', 'this', 'year', 'it', 'was', 'legal', 'for', 'apartments', 'in', 'Austin,', 'Texas', 'to', 'have', 'no', 'windows,', 'and', 'that', 'landlords', 'often', "didn't", 'disclose', 'this', 'in', 'advertisements', 'https://theconversation.com/college-students-in-austin-texas-have-dwelled-in-windowless-rooms-for-years-heres-why-the-city-finally-decided-to-ban-them-228349', 'r/todayilearned', '-', 'TIL', 'that', 'until', 'earlier', 'this', 'year', 'it', 'was', 'legal', 'for', 'apartments', 'in', 'Austin,', 'Texas', 'to', 'have', 'no', 'windows,', 'and', 'that', 'landlords', 'often', "didn't", 'disclose', 'this', 'in', 'advertisements']
text = """
r/todayilearned icon
r/todayilearned
•
3 hr. ago
Join
TIL that until earlier this year it was legal for apartments in Austin, Texas to have no windows, and that landlords often didn't disclose this in advertisements
https://theconversation.com/college-students-in-austin-texas-have-dwelled-in-windowless-rooms-for-years-heres-why-the-city-finally-decided-to-ban-them-228349
r/todayilearned - TIL that until earlier this year it was legal for apartments in Austin, Texas to have no windows, and that landlords often didn't disclose this in advertisements
Upvote
9K
Downvote
398
comments
Share
Share
u/DraftKings avatar
u/DraftKings
• Official
•
Promoted
Hey Reddit, the time has finally come. Football is BACK. Start your NFL season off strong with DraftKings Sportsbook where new customers can Bet $5 on any NFL team to Get $250 in bonus bets INSTANTLY!
Hey Reddit, the time has finally come. Football is BACK. Start your NFL season off strong with DraftKings Sportsbook where new customers can Bet $5 on any NFL team to Get $250 in bonus bets INSTANTLY!
sportsbook.draftkings.com
Sign Up
UpvoteVote
Downvote
0
comments
Share
Share
This is one of the most emotional videos that made me cry. Dad discovers his daughter has anonymously donated a kidney, bringing him to tears
r/MadeMeSmile icon
r/MadeMeSmile
•
4 hr. ago
Join
This is one of the most emotional videos that made me cry. Dad discovers his daughter has anonymously donated a kidney, bringing him to tears
1:10 / 1:10
Upvote
15K
Downvote
734
comments
Share
"""
t2 = "Hey Reddit, the time has finally come. Football is BACK. Start your NFL season off strong with DraftKings Sportsbook where new customers can Bet $5 on any NFL team to Get $250 in bonus bets INSTANTLY!"
print(t2.split())
['Hey', 'Reddit,', 'the', 'time', 'has', 'finally', 'come.', 'Football', 'is', 'BACK.', 'Start', 'your', 'NFL', 'season', 'off', 'strong', 'with', 'DraftKings', 'Sportsbook', 'where', 'new', 'customers', 'can', 'Bet', '$5', 'on', 'any', 'NFL', 'team', 'to', 'Get', '$250', 'in', 'bonus', 'bets', 'INSTANTLY!']
print(re.split(r'[ .!,:;()]+', t2 ))
['Hey', 'Reddit', 'the', 'time', 'has', 'finally', 'come', 'Football', 'is', 'BACK', 'Start', 'your', 'NFL', 'season', 'off', 'strong', 'with', 'DraftKings', 'Sportsbook', 'where', 'new', 'customers', 'can', 'Bet', '$5', 'on', 'any', 'NFL', 'team', 'to', 'Get', '$250', 'in', 'bonus', 'bets', 'INSTANTLY', '']
list(re.finditer(r'[ .!,:;()]+', t2 ))
[<re.Match object; span=(3, 4), match=' '>, <re.Match object; span=(10, 12), match=', '>, <re.Match object; span=(15, 16), match=' '>, <re.Match object; span=(20, 21), match=' '>, <re.Match object; span=(24, 25), match=' '>, <re.Match object; span=(32, 33), match=' '>, <re.Match object; span=(37, 39), match='. '>, <re.Match object; span=(47, 48), match=' '>, <re.Match object; span=(50, 51), match=' '>, <re.Match object; span=(55, 57), match='. '>, <re.Match object; span=(62, 63), match=' '>, <re.Match object; span=(67, 68), match=' '>, <re.Match object; span=(71, 72), match=' '>, <re.Match object; span=(78, 79), match=' '>, <re.Match object; span=(82, 83), match=' '>, <re.Match object; span=(89, 90), match=' '>, <re.Match object; span=(94, 95), match=' '>, <re.Match object; span=(105, 106), match=' '>, <re.Match object; span=(116, 117), match=' '>, <re.Match object; span=(122, 123), match=' '>, <re.Match object; span=(126, 127), match=' '>, <re.Match object; span=(136, 137), match=' '>, <re.Match object; span=(140, 141), match=' '>, <re.Match object; span=(144, 145), match=' '>, <re.Match object; span=(147, 148), match=' '>, <re.Match object; span=(150, 151), match=' '>, <re.Match object; span=(154, 155), match=' '>, <re.Match object; span=(158, 159), match=' '>, <re.Match object; span=(163, 164), match=' '>, <re.Match object; span=(166, 167), match=' '>, <re.Match object; span=(170, 171), match=' '>, <re.Match object; span=(175, 176), match=' '>, <re.Match object; span=(178, 179), match=' '>, <re.Match object; span=(184, 185), match=' '>, <re.Match object; span=(189, 190), match=' '>, <re.Match object; span=(199, 200), match='!'>]
import re
re.search(r'^([gG]roundhog|[wW]oodchuck)$', "groundhog")
<re.Match object; span=(0, 9), match='groundhog'>
re.search(r'^([gG]roundhog|[wW]oodchuck)(|s)$', "groundhog")
<re.Match object; span=(0, 9), match='groundhog'>
Is it easy to hard to break up a text into sentences?