import re


def parse_words(phrase, preserve_case=False, split_by_space=False):
    """Create a non-unique wordlist from sample text. Language
    independent (e.g. works with Chinese characters)

    Parameters
    ----------
    phrase : str
        Sample text that could contain one or more words
    preserve_case : bool, optional
        A flag to determine if we can to preserve the cases or convert
        all to lowercase
    split_by_space: bool, optional
        Splits the phrase into words simply based on space
    Returns
    list
        A list of words
    """
    if split_by_space:
        if preserve_case:
            return phrase.split()
        else:
            return phrase.lower().split()
    # \W non-words, use negated set to ignore non-words and "_"
    # (underscore). Compatible with non-latin characters, does not
    # split words at apostrophes
    if preserve_case:
        return re.findall(r"([^\W_]+['’-]*[^\W_]*)", phrase)
    else:
        return re.findall(r"([^\W_]+['’-]*[^\W_]*)", phrase.lower())