def clean_text(text: str) -> str:
    """
    Clean raw text string.

    Args:
        text (str): Raw text to clean.

    Returns:
        str: cleaned text.

    """
    # Spacing and filters
    text = re.sub(
        r"([!\"'#$%&()*\+,-./:;<=>?@\\\[\]^_`{|}~])", r" \1 ", text
    )  # add spacing
    text = re.sub("[^A-Za-z0-9]+", " ", text)  # remove non alphanumeric chars
    text = re.sub(" +", " ", text)  # remove multiple spaces
    text = re.sub(r"http\S+", "", text)  # remove links
    text = re.sub("Was this review helpful? Sign in to vote.", "", text)
    text = re.sub("Permalink", "", text)
    text = re.sub(r"\.\.\.", "", text)
    text = re.sub(r"\.\.", "", text)
    text = re.sub('""', "", text)
    # Use re.search to find the match in the sentence
    text = re.sub(r"\d+ out of \d+ found this helpful", "", text)
    return text.strip()  # strip white space at the ends

    Clean raw text string.

    Args:
        text (str): Raw text to clean.

    Returns:
        str: cleaned text.

    
llama-index-integrations/readers/llama-index-readers-imdb-review/llama_index/readers/imdb_review/scraper.py