def preprocess_french ( trans , fr_nlp , remove_brackets_content = True ) : if remove_brackets_content : trans = pangloss . remove_content_in_brackets ( trans , "[]" ) # Not sure why I have to split and rejoin, but that fixes a Spacy token # error. trans = fr_nlp ( " " . join ( trans . split ( ) [ : ] ) ) #trans = fr_nlp(trans) trans = " " . join ( [ token . lower_ for token in trans if not token . is_punct ] ) return trans
remove stopwords in french python
Takes a list of sentences in french and preprocesses them .
def preprocess_french(trans, fr_nlp, remove_brackets_content=True):
    """ Takes a list of sentences in french and preprocesses them."""

    if remove_brackets_content:
        trans = pangloss.remove_content_in_brackets(trans, "[]")
    # Not sure why I have to split and rejoin, but that fixes a Spacy token
    # error.
    trans = fr_nlp(" ".join(trans.split()[:]))
    #trans = fr_nlp(trans)
    trans = " ".join([token.lower_ for token in trans if not token.is_punct])

    return trans