Parse `keywords` from HTML ``<meta>``, dublin core and from text.

    Args:
        index_page (str): Content of the page as UTF-8 string.
        map_to_nk_set (bool): Should the algorithm try to map keywords to
            keywords used in NK?

    Returns:
        list: List of :class:`.SourceString` objects.

def get_keyword_tags(index_page, map_to_nk_set=True):
    """
    Parse `keywords` from HTML ``<meta>``, dublin core and from text.

    Args:
        index_page (str): Content of the page as UTF-8 string.
        map_to_nk_set (bool): Should the algorithm try to map keywords to
            keywords used in NK?

    Returns:
        list: List of :class:`.SourceString` objects.
    """
    dom = dhtmlparser.parseString(index_page)

    keywords = [
        get_html_keywords(dom),
        get_dc_keywords(dom),
    ]
    # do not try to match extracted_keywords, because they are based on Aleph's
    # dataset
    extracted_keywords = extract_keywords_from_text(index_page)

    keywords = sum(keywords, [])  # flattern

    if not map_to_nk_set:
        return keywords + extracted_keywords

    def try_match(keyword):
        """
        This provides chance to speed up the process a little.
        """
        kw = KEYWORDS_LOWER.get(keyword.lower())
        if kw:
            return kw

        return process.extractOne(str(keyword), KEYWORDS)[0].encode("utf-8")

    keywords = [
        SourceString(
            try_match(keyword),
            source=keyword.source,
        )
        for keyword in keywords
    ]

    return sorted(list(set(keywords + extracted_keywords)))