Ну, вы можете извлечь URL, используя Spacy . Затем вы можете взять URL-адреса в списке, и с помощью простого python вы можете сделать свою работу. Давайте возьмем, мы взяли URL в списке под названием URL ...
sentence = "hi.hello.stackoverflow.com or nltk.org"
URL = ["stackoverflow.com", "nltk.org"]
# to remove URLs from our sentence and place a number so we can later replace
# our URLs there
x=0
for i in URL:
sentence = sentence.replace(i,str(x))
x+=1
# put period with space
sentence=sentence.split(".")
sentence = ". ".join(sentence)
# replace our URLs in the correct place
x=0
for i in URL:
sentence = sentence.replace(str(x),i)
x+=1
print(sentence)
# output - "hi. hello. stackoverflow.com or nltk.org"