Skip to content

Instantly share code, notes, and snippets.

@nicksyna01
nicksyna01 / bulk_email.py
Created July 22, 2019 20:53
Code to send email to a lot of people and landing that to their inbox instead of spam
import smtplib
import pandas as pd
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
mail_content = """
Question: a. What are the symptoms of Nipah?Common carriers of Nipah virus?
c. Nipah is which type of virus?
d. How is it spread normally?
e. First place of it’s outbreak?
@nicksyna01
nicksyna01 / Page_Links_Extraction.py
Created July 22, 2019 20:38
Code to Extract Links of all the Pages in a Website
@nicksyna01
nicksyna01 / Google_Search_&_Scraping.py
Created July 22, 2019 20:35
Python Code to Google_Search followed by Web_Scraping and Saving that to a Document
from googlesearch import search
import urllib.request as ur
from bs4 import BeautifulSoup
try:
from googlesearch import search
except ImportError:
print("No module named 'google' found")
@nicksyna01
nicksyna01 / Google_Search.py
Created July 22, 2019 20:32
Using Google Search Function Using Python To Search For a Term and Showing the Top Results for it
from googlesearch import search
import urllib.request as ur
from bs4 import BeautifulSoup
try:
from googlesearch import search
except ImportError:
print("No module named 'google' found")
@nicksyna01
nicksyna01 / classifiers.py
Created July 22, 2019 20:22
How to use basic classifiers
from sklearn.tree import DecisionTreeClassifier
from sklearn.neighbors import KNeighborsClassifier
from sklearn.neural_network import MLPClassifier
from sklearn.ensemble import RandomForestClassifier
#{height, weights, shoe size}
X = [[190,70,44],[166,65,45],[190,90,47],[175,64,39],[171,75,40],[177,80,42],[160,60,38],[144,54,37]]
Y = ['male','male','male','male','female','female','female','female']
#Predict for this vector (height, wieghts, shoe size)
@nicksyna01
nicksyna01 / sentence_tokenizer.py
Created July 22, 2019 20:16
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')
@nicksyna01
nicksyna01 / text_classification.py
Last active November 18, 2020 05:16
Text Classification
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, confusion_matrix
from sklearn.metrics import classification_report
from sklearn.naive_bayes import MultinomialNB
from sklearn.pipeline import Pipeline
from sklearn.feature_extraction.text import TfidfTransformer
from sklearn.feature_extraction.text import CountVectorizer, TfidfVectorizer
#Are the tags which we are using currently for tagging the sentences