Implement a function to calculate the perplexity of a language model given a sequence of token probabilities.
Perplexity is a widely used metric for evaluating language models. It quantifies how well a probability distribution predicts a sample - a lower perplexity indicates the model assigns higher probabilities to the actual observed tokens, meaning it's a better predictor.
Given a list of probabilities where each probability represents the model's predicted probability for the actual next token in a sequence, compute the perplexity score.
probabilities: A list of floats where each value represents P(token_i | context) for the i-th token in the sequence. All probabilities are in the range (0, 1].