Skip to content

Instantly share code, notes, and snippets.

@hamletbatista
Created April 26, 2020 01:02
Show Gist options
  • Save hamletbatista/74730874b7e0540cd51d3ab749f18ffd to your computer and use it in GitHub Desktop.
Save hamletbatista/74730874b7e0540cd51d3ab749f18ffd to your computer and use it in GitHub Desktop.
def get_feature_names(indices):
serp_index=["Instant answer", "Knowledge panel", "Carousel", "Local pack", "Top stories", "Image pack", "Site links", "Reviews", "Tweet", "Video", "Featured video", "Featured Snippet", "AMP", "Image", "AdWords top", "AdWords bottom", "Shopping ads", "Hotels Pack", "Jobs search", "Featured images", "Video Carousel", "People also ask"]
index_list = indices.split(",")
feature_names = list()
for i in index_list:
if len(i) > 0:
try:
feature_names.append(serp_index[int(i)])
except:
print(f"Error, no such index: {i}")
return feature_names
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment