def read_keywords(args):
    """This function reads the keywords from the input file and creates:

    - a dictionary where the key is the old name and the value is the new name,
      these keywords will be further processed.
    - a list of keywords which will not be processed, typically keywords with
    argument(s) in its names.
    - a list of duplicates - duplicated keyword names or names which are parts
    of another keyword name, they will not be processed.

    :param args:  Parsed arguments.
    :type args: ArgumentParser
    :returns: keyword names - dictionary where the key is the old name and the
    value is the new name; ignored keyword names - list of keywords which will
    not be processed; duplicates - duplicated keyword names or names which are
    parts of another keyword name, they will not be processed.
    :rtype: tuple(dict, list, list)
    """

    kw_names = dict()
    ignored_kw_names = list()
    duplicates = list()

    for line in args.input:
        old_name, new_name = line.split(args.separator)
        if '$' in old_name:
            ignored_kw_names.append((old_name, new_name[:-1]))
        elif old_name in kw_names.keys():
            duplicates.append((old_name, new_name[:-1]))
        else:
            kw_names[old_name] = new_name[:-1]

    # Remove duplicates:
    for old_name, _ in duplicates:
        new_name = kw_names.pop(old_name, None)
        if new_name:
            duplicates.append((old_name, new_name))

    # Find KW names which are parts of other KW names:
    for old_name in kw_names.keys():
        count = 0
        for key in kw_names.keys():
            if old_name in key:
                count += 1
            if old_name in kw_names[key]:
                if old_name != key:
                    count += 1
        if count > 1:
            duplicates.append((old_name, kw_names[old_name]))
            kw_names.pop(old_name)

    return kw_names, ignored_kw_names, duplicates