-1

How can I combine all the tokenized words into a sentence in a column?

tokenized_word = ['really','smart','people']

in a sentence = really smart people

desertnaut
  • 57,590
  • 26
  • 140
  • 166

2 Answers2

1

There is a standard join operation in Python:

sentence = ' '.join(tokenized_word)

If you want to convert it to Pandas column, you can do it like this:

`df['col_name'] = sentence

Andrey Lukyanenko
  • 3,679
  • 2
  • 18
  • 21
1
def remove_punctuation(txt):
  txt_nopunt = " ".join([c for c in txt if c not in string.punctuation])
  return txt_nopunt

data['tokenized_word'] = data['tokenized_word'].apply(lambda x: remove_punctuation(x))
kwsp
  • 1,184
  • 7
  • 26