def get_ranks(keywords, script):
    """Return ranks of queried keyword in a given script.

    Parameters
    ----------
    keywords : str[]
        Array of keywords to search in the script.
    script : dict[]
        JSON object containing ranks of different keywords.
    
    Returns
    -------
    ranks : int[]
        Array of integers in the same order as their respective keywords
    
    """
    ranks = []

    # Populate list of ranks
    for keyword in keywords:
        for d in script:
            if d['keyword'] == keyword:
                ranks.append(d['rank'])
                break
        # If no rank has been specified for a word, set its rank to 0
        else:
            ranks.append(0)
    
    return ranks