ranking-challenge icon indicating copy to clipboard operation
ranking-challenge copied to clipboard

Return list of expanded URLs instead of just the string of only the first URL

Open hauselin opened this issue 10 months ago • 2 comments

Hi, I noticed in the line below the code only returns the first expanded URL (urls[0]), and returns it as a string. Often, there are multiple URLs, so it would be great if all expanded URLs in any given tweet were returned. See the suggestion below. Thanks!

https://github.com/HumanCompatibleAI/ranking-challenge/blob/28b900e18b7aa44855309b2bbb164a2365ffc75d/sample_data/preprocessing.py#L186

# current: returns string and returns only the first expanded URL
expanded_url = urls[0].get("expanded_url", None) if urls else None

# suggestion: returns list of all expanded URLs
expanded_urls = [url.get("expanded_url") for url in urls if url.get("expanded_url")]

hauselin avatar Apr 15 '24 06:04 hauselin