from typing import Dict
from typing import Any
import json


def process_feature_file(filename: str) -> Dict[str, Any]:
    """
    Each feature for RankLib is defined in a JSON file with its name and formula.

    Args
    ----
      filename: str
          Filename containing definition for a specific feature.

    Returns
    -------
      feature: str
          JSON feature processed.
    """
    feature = json.loads(open(filename).read())
    template = feature['query']
    name = feature['name']
    params = feature['params']
    feature_spec = {
        'name': name,
        'template': template,
        'params': params
    }
    return feature_spec