mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +03:00
Check for email address first
This commit is contained in:
parent
afd9fc9d36
commit
6455b574fc
|
@ -74,6 +74,8 @@ def like_email(text):
|
|||
|
||||
|
||||
def like_url(text):
|
||||
if '@' in text: # prevent matches on e-mail addresses
|
||||
return False
|
||||
# We're looking for things that function in text like URLs. So, valid URL
|
||||
# or not, anything they say http:// is going to be good.
|
||||
if text.startswith('http://') or text.startswith('https://'):
|
||||
|
@ -82,8 +84,6 @@ def like_url(text):
|
|||
return True
|
||||
if text[0] == '.' or text[-1] == '.':
|
||||
return False
|
||||
if '@' in text: #prevent matches on e-mail addresses
|
||||
return False
|
||||
for i in range(len(text)):
|
||||
if text[i] == '.':
|
||||
break
|
||||
|
|
Loading…
Reference in New Issue
Block a user