def calibrate_valences(valences, neutralscaler, stdev_adj,
                       firstvalencecol=1, showcomponents=False):
    """Calibrate valences by standardizing based on scaling data passed in.

    This is a very simplified version of the dataframe-based calibrate_valencedata

    Main data passed in should be a list of valencedata items.
    A valencedata item is a list containing a scaling value and N valence values (where N is the number of lexica used)
    The scaling value is usually the first item in the list, and generally is the word count of the corresponding text.

    Since the data is already scaled, we can ignore the scaling value.
    For each of the valence values, we do the corresponding standardization from the neutralscaler passed in.
    Then we average the resulting values and divide by the stdev_adj to get a calibrated value.

    For each valencedata item we return the calibrated value and optionally the individual calibrated components.

    Note: this is a simplified version of calibrate_features (see above), which we use to calibrate files
          with valence data. At some point, we might decompose calibrate_features to call the present function
          for the central calibration step.
    """
    nrlexica = len(valences[0][firstvalencecol:])
    calibratedlexvalences = neutralscaler.transform([valencedataitem[firstvalencecol:] for valencedataitem in valences])

    divisor = nrlexica * stdev_adj
    calibratedvalences = [sum(vals)/divisor for vals in calibratedlexvalences]

    if showcomponents:
        return [(calval, callexvals) for calval, callexvals in zip(calibratedvalences, calibratedlexvalences)]
    else:
        return calibratedvalences