Created
December 3, 2018 10:44
Star
You must be signed in to star a gist
Small functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def url_to_filename(row): #Takes a pandas row | |
url = row.url | |
url = re.sub(r"://", r"__", url) | |
url = re.sub(r"/", r"_", url) | |
row.url = re.sub(r"\.?(cms|html|ece|ece1)?$", r".folia.xml", url) | |
return row | |
def getwordtext(entity): #Takes a folia entity | |
annot = "" | |
for word in entity.wrefs(): | |
annot = annot + word.text() | |
if word.space: | |
annot = annot + " " | |
return re.sub(r" $", r"", annot) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment