我目前正在使用 AWS Lambda。以下是代码片段:
import pandas as pd
import re
import nltk
from stop_words import get_stop_words
stopwords = get_stop_words('en')
nltk.download('punkt')
nltk.download('wordnet')
wn = nltk.WordNetLemmatizer()
def lemmatization(txt):
text = ([wn.lemmatize(word) for word in txt])
return text
def lambda_handler(event,context):
bucket = "aaabbb"
key = "cccddd"
s3_client = boto3.client('s3')
s3_file = s3_client.get_object(Bucket=bucket, Key=key)
s3_file_data = s3_file['Body'].read()
s3_file_data = io.BytesIO(s3_file_data)
df = pd.read_csv(s3_file_data)
df['ABC'] = df['ABC'].apply(lambda x: lemmatization(x))
print(df)
然而,我一直收到这个错误提示:
Unable to import module 'lambda_function': No module named 'regex._regex'
我已经导入了nltk和regex包。你能帮我处理一下吗?