I have pos_token dataset and I want to transform them to be a sentence again using pandas
pos_token | sentence |
---|---|
[(No, DT), (you, PRP), (lying, VBG)] | No you lying |
if pos_token is a list values then try this;
df = pd.DataFrame({"pos_token":[[("No", "DT"), ("you", "PRP"), ("lying", "VBG")]]})
df["sentence"] = df["pos_token"].apply(lambda x: " ".join([i[0] for i in x]))
# output
pos_token sentence
0 [(No, DT), (you, PRP), (lying, VBG)] No you lying