Skip to content

Commit f99719f

Browse files
authored
Update hindi_POS_tag_removal.py
1 parent ee1854c commit f99719f

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

Remove_POS_hindi_text/hindi_POS_tag_removal.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
import string
22
import nltk
3+
import sys
4+
import os
35

4-
fp=open(r"C:\Users\ZAVERI SANYA\Desktop\Amazing-Python-Scripts\Remove_POS_hindi_text\\Tagged_Hindi_Corpus.txt",mode="r",encoding="utf-8") #opens the hindi_tagged_corpus.txt file
5-
fd=open(r"C:\Users\ZAVERI SANYA\Desktop\Amazing-Python-Scripts\Remove_POS_hindi_text\\Only_Hindi.txt",mode="a",encoding="utf-8")
6+
user_input=input(' Enter file location of your Tagged Hindi Text: ')
7+
#C:\Users\ZAVERI SANYA\Desktop\Amazing-Python-Scripts\Remove_POS_hindi_text\\Tagged_Hindi_Corpus.txt
8+
assert os.path.exists(user_input), "I did not find the file at, "+str(user_input)
9+
fp=open(user_input,mode="r",encoding="utf-8") #opens the hindi_tagged_corpus.txt file
10+
print("Hooray we found your file!")
11+
12+
user_answer= input (' Enter file location where you wish to get your Only Hindi Text file: ')
13+
#C:\Users\ZAVERI SANYA\Desktop\Amazing-Python-Scripts\Remove_POS_hindi_text\Only_Hindi.txt
14+
fd=open(user_answer,mode="a",encoding="utf-8")
615
data=fp.read()
716
data_token=nltk.tokenize.word_tokenize(data) #data tokenization
817
words=[]
@@ -18,5 +27,6 @@
1827
for word in words:
1928
str+=word+" " #it concatenates the words
2029
fd.write(str) #writes to only_hindi.txt file
30+
print("Hooray your Only Hindi Text file is ready...Please Check!")
2131
fp.close()
2232
fd.close()

0 commit comments

Comments
 (0)