Regex to remove links in the dataset

#1
by ThiloteE - opened

Not sure, if it is helpful having links in there. In case, you or anybody wants to get rid of them, I think you could filter them out via regex or some other method.
This is how a markdown formated text with link and title usually looks like: [Link text with [brackets] inside](http://www.example.com "My \"title\"")

This is the regex I came up with (\[)(?:.*?)(\])(\(http.*?\)) after getting inspired by https://www.michaelperrin.fr/blog/2019/02/advanced-regular-expressions and https://www.debuggex.com/#cheatsheet. Use it at your own risk. I don't think it is perfect, but it is a start. The regex does not work with perl regex in notepad++, but javascript or python should be compatible.

To be honest, I find it hard to cite any irregularities in the dataset, since none of the texts has an ID attached to it and it is not possible to search through the dataset. I simply looked at a random page and a random text and then clicked a few more to find lots of links contained in the text.

ThiloteE changed discussion title from Many links in the dataset to Regex to remove links in the dataset
Owner

Hmm for a pure text model this might be an issue, but the number of links is really low compared to the rest of the dataset, and they appear more to the beginning of the dataset with the high quality questions that cite sources more often.

A plus though, is that this entire dataset should be either text or formatted markdown, which means that a model might be able to websearch, by looking for the links the same way you want to remove them.

The links aren't many training tokens, but can be used to the models advantage, so I'll leave them there.

Sign up or log in to comment