This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* To change this template, choose Tools | Templates | |
* and open the template in the editor. | |
*/ | |
package assignment11; | |
import images.*; | |
import assignment11.ImagePreviewPanel; | |
import java.awt.Graphics; | |
import java.awt.Window; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
soundex=[0,1,2,3,0,1,2,0,0,2,2,4,5,5,0,1,2,6,2,3,0,1,0,2,0,2] | |
print "Enter the word to be hashed" | |
word=raw_input() | |
word=word.upper() | |
coded=word[0] | |
for c in word[1:len(word)]: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print "Enter the Line" | |
line=raw_input() | |
print "Now enter the string to be seached" | |
search=raw_input() | |
old_len=len(search) | |
found=False | |
try: | |
while(len(search)<=len(line)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
String = "ABRACADABRA" | |
pat = "DA" | |
pat1 = pat | |
if len(String) < len(pat): | |
print "Enter Correct Pattern" | |
for i in range(0,(len(String)-len(pat))+1): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob | |
import math | |
line='' | |
s=set() | |
flist=glob.glob(r'E:\PROGRAMMING\PYTHON\programs\corpus2\*.txt') #get all the files from the d`#open each file >> tokenize the content >> and store it in a set | |
for fname in flist: | |
tfile=open(fname,"r") | |
line=tfile.read() # read the content of file and store in "line" | |
tfile.close() # close the file | |
s=s.union(set(line.split(' '))) # union of common words |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def distance(a,b): | |
x=float(a[0])-float(b[0]) | |
x=x*x | |
y=float(a[1])-float(b[1]) | |
y=y*y | |
dist=round(math.sqrt(x+y),2) | |
return dist |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from operator import add | |
def inp(): | |
pts=raw_input('Enter Number of Points.: ') | |
i=0 | |
global points | |
points=[] | |
b=[] | |
while(i<int(pts)): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node: | |
def __init__(self): | |
self.next = {} | |
self.word_marker = False | |
def add(self, string): | |
if len(string) == 0: | |
self.word_marker = True |