Skip to content

Instantly share code, notes, and snippets.

View anishmashankar's full-sized avatar

Anish Mashankar anishmashankar

  • System Insights
  • Chennai, India
View GitHub Profile
@anishmashankar
anishmashankar / spam_classifier.py
Last active May 16, 2016 19:57
Developing a Naive Bayes Classifier for Spam Detection in Python
#Author: Anish Mashankar
#website: anishm.co
import random
import time
import nltk
from textblob import TextBlob
from nltk.corpus import stopwords
from text.classifiers import NaiveBayesClassifier
def get_list_tuples(read_file):
list_tuples = []
@anishmashankar
anishmashankar / Water Jug Problem.py
Last active August 29, 2015 14:13
Water Jug problem. An arithmatic approach
#Written by: Anish Mashankar
#Blog: http://techieanish.blogspot.com
#####BEGIN#####
print 'enter capacity of first jug'
x_capacity = input()
print 'enter capacity of second jug'
y_capacity = input()
print 'enter goal capacity'
x_goal = input()
@anishmashankar
anishmashankar / water_jug_state_space_search.py
Last active August 29, 2015 14:13
Water Jug problem, using state space search
#Written by: Anish Mashankar
#Blog: http://techieanish.blogspot.com
class WaterJug:
def __init__(self, x, y, goal_x, goal_y):
self.JUG_1 = x
self.JUG_2 = y
self.j_1 = 0
self.j_2 = 0
@anishmashankar
anishmashankar / tictactoe.py
Created February 17, 2015 02:02
TIC TAC TOE FINAL
board=[' ' for x in range(9)]
#legal board values = X,O
board[4] = 'X'
winning=False
def player_move():
global winning
pos = input("Enter your move ")
board[pos] = 'O'
winning = checkwin('O')
@anishmashankar
anishmashankar / a-star-search.py
Created February 24, 2015 06:08
For a matrix without obstacles
'''
1 1 1 1
1 1 1 1
1 1 1 1
1 1 1 1
'''
import heapq
from math import sqrt
from math import pow
import sys
text = "Virat Kohli has stayed in the shadows even as India knocked off all their six group-stage opponents to reach the quarter-finals of the World Cup. After his 107 against Pakistan in their opening game at the Adelaide Oval, Kohli managed another 194 runs from the next five matches, without a single fifty to his name. He aggregates 301 and does not even find a place in the top-10 run-scorers in the tournament. However, West Indian legend Brian Lara felt the Indian batting mainstay will deliver once the World Cup gets into the business-end from this week"
#words = set(text.split(" "))
words = ['ced','ted','med','red','rai','rwq','ren','rem']
to_find = raw_input()
first_list = []
found=False
for word in words:
if len(word) == len(to_find):
first_list.append(word)
import sys
symptoms={
'tb' : ['cough', 'pain', 'weight loss', 'exhaustion', 'fever','night sweat','chills'],
'dengue': ['pain', 'swollen lympth node', 'fever', 'exhaustion'],
'h1n1' : ['cough', 'fever', 'sore throat', 'runny nose', 'pain', 'headache', 'chills', 'exhaustion']
}
print 'do you have fever?'
fever = input()
if fever==0:
sys.exit()
@anishmashankar
anishmashankar / starwars.py
Created November 27, 2015 08:34
A simple script that will download all the Star Wars : The Force Awakens wallpapers from Google's Chrome Extension.
# Created by Anish Mashankar
# Website: http://anishm.co
# This is a simple script that will download all the Star Wars: The Force Awakens wallpapers
# The image files will be stored on the same destination where this script is kept if the promt is left blank
# May the force be with you
import urllib
folder = raw_input("Where do you want your images to be stored? Enter the path to folder")
for i in range(1,12):
myurl = "https://www.gstatic.com/beyond/img/l"+str(i)+".jpg"