Outreachy Application Task: Simple example of topic classification


First I import import requests

I included 'revids' as one of the parameters in order to get the appropriate response and parsed through the json_data with the right keys to get the qid.

I included the 'entity' parameter for the function below and the value for the 'action' parameter set to 'wbgetclaims'.

For the function below, assumung it accepts a list of tuples as claims and a dictionary as embeddings:

The 'claims_array' below flattens the list of claims and each item is used as an index in embeddings to get the corresponding embedding of the property/value using a list comprehension and everything converted into a numpy array.