0% found this document useful (0 votes)
1 views1 page

S 20

The document includes an XML snippet for creating a student file with at least five student entries. It also contains a Python script that removes stopwords from a given text paragraph about the Python Programming Academy. The script utilizes the NLTK library for tokenization and stopword removal.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views1 page

S 20

The document includes an XML snippet for creating a student file with at least five student entries. It also contains a Python script that removes stopwords from a given text paragraph about the Python Programming Academy. The script utilizes the NLTK library for tokenization and stopword removal.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

//create a student.

xml file containing at least 5 student information

<?xml version="1.0" encoding="UTF-8"?>


<Students>
<Student>
<name>s1</name>
<rno>1</rno>
</student>
</Students>

//Consider text paragraph."""Hello all, Welcome to Python Programming Academy.


Python
Programming Academy is a nice platform to learn new programming skills. It is
difficult to get enrolled in this Academy."""Remove the stopwords.

import nltk
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize

text = """Hello all, Welcome to Python Programming Academy. Python Programming


Academy is a nice platform to learn new programming skills. It is difficult to get
enrolled in this Academy."""

nltk.download('stopwords')
nltk.download('punkt')

words = word_tokenize(text)
stop_words = set(stopwords.words('english'))
filtered_words = [word for word in words if word.lower() not in stop_words]
filtered_text = ' '.join(filtered_words)

print("Original Text:\n", text)


print("\nText after removing stopwords:\n", filtered_text)

You might also like