def chart_title(plot_id, series_index):
    """Replaces generic Concept or Entity strings from chart titles with more
    specific name if it was specified.

    :param plot_id: Automatic title for chart
    :param series_index: Aggregation's index column name
    :return: str -- New chart title
    """
    if series_index in {'Concept', 'Entity'}:
        return plot_id

    if 'Concept' in plot_id:
        if 'Concepts' in plot_id:
            return plot_id.replace('Concepts', series_index + 's')
        else:
            return plot_id.replace('Concept', series_index)

    if 'Entities' in plot_id:
        return plot_id.replace('Entities', series_index + 's')

    # For non concept and non absa aggregations
    return plot_id