stopwords
<?php
//Establi
shconnectiontoPostgreSQLdatabase
$conn=pg_connect(“host=l
ocalhostdbname=your_database_nameuser=your_username
password=your_password”);
//Checkifconnectionwassuccessful
If(!$conn){
Echo“Connectionfail
ed.”;
Exit;
}
//Createstudenttabl
e
$query=“CREATETABLEstudent(
RollnoINTEGERPRIMARYKEY,
NameVARCHAR(50)NOTNULL,
ClassVARCHAR(10)NOTNULL
)”;
$result=pg_query($conn,$query);
If(!$resul
t){
Echo“Errorcreati
Exit;
}else{
ngtable:“.pg_last_error($conn);
Echo“Tablecreatedsuccessful
}
ly.<br>”;
//Insert5recordsi
ntostudenttable
$insert_query=“I
NSERTINTOstudent(rollno,name,class)
VALUES(1,‘JohnDoe’,‘
10A’),
(2,‘JaneSmith’
,‘9B’
),
(3,‘BobJohnson’
,‘11C’
(4,‘SarahLee’
,‘12D’
),
(5,‘TomBrown’,‘
),
8E’)”;
$insert_resul
t=pg_query($conn,$insert_query);
If(!$i
nsert_resul
t){
Echo“Errorinserti
Exit;
}else{
ngrecords:“.pg_last_error($conn);
Echo“Recordsinsertedsuccessful
ly.”;
}
//Closedatabaseconnection
Pg_close($conn);
?>
Importnltk
Fromnltk.corpusi
mportstopwords
Fromnltk.tokeni
zeimportword_tokenize
#sampletextparagraph
Text=“Helloall
,WelcometoPythonProgrammingAcademy.PythonProgrammingAcademyis
aniceplatformtolearnnewprogrammingskill
#tokenizethetextparagraph
Words=word_tokenize(text)
#definestopwords
Stop_words=set(stopwords.words(‘
#removestopwords
Filtered_words=[wordforwordi
english’
s.Itisdiffi
culttogetenrol
ledinthisAcademy.”
))
nwordsifword.casefold()noti
nstop_words]
#joinfil
teredwordstoformasentence
Filtered_sentence=‘‘
.joi
n(fil
Print(fi
ltered_sentence)