Created
July 22, 2019 20:16
-
-
Save nicksyna01/a065c20fb2ab6218c4eeb6d1fd7691f8 to your computer and use it in GitHub Desktop.
Simple Code to Convert Text to Sentences
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.