Skip to content

Instantly share code, notes, and snippets.

@nicksyna01
Created July 22, 2019 20:16
Show Gist options
  • Select an option

  • Save nicksyna01/a065c20fb2ab6218c4eeb6d1fd7691f8 to your computer and use it in GitHub Desktop.

Select an option

Save nicksyna01/a065c20fb2ab6218c4eeb6d1fd7691f8 to your computer and use it in GitHub Desktop.
Simple Code to Convert Text to Sentences
from nltk import tokenize
import pandas as pd
import csv
p = ''''''
sent = tokenize.sent_tokenize(p)
#print(len(sentence))
#sent.to_csv('out.csv')
my_df = pd.DataFrame(sent)
my_df.to_csv('out.csv', index=False, header=False)
print(my_df)
@nicksyna01
Copy link
Copy Markdown
Author

One just need to change the directory where he/she wants to save their file csv file and secondly they can paste their text data inside triple quotes of p and can get output subsequently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment