Skip to content

Instantly share code, notes, and snippets.

@umedsondoniyor
Created December 1, 2017 16:59
Show Gist options
  • Save umedsondoniyor/94d181d4f48bc6bc9030db9f8b8241e9 to your computer and use it in GitHub Desktop.
Save umedsondoniyor/94d181d4f48bc6bc9030db9f8b8241e9 to your computer and use it in GitHub Desktop.
quize_vocabulary
metin1 = ["web", "net"]
metin2 = ["graph", "web", "net"]
metin3 = ["page", "web", "complex", "net"]
voc = []
vec = [2, 2, 2, 2, 2]
def vocabulary(test):
for x in test:
if (x not in voc):
voc.append(x)
else:
print x + ' var zaten'
print "\n"
print "************ Vocabulary olusturma kismi ***************"
vocabulary(metin1)
vocabulary(metin2)
vocabulary(metin3)
print voc
def check(check):
for metin in range(len(check)):
for vocab in range(len(voc)):
if check[metin - 1] in voc[vocab - 1]:
vec[vocab - 1] = 1
else:
if vec[vocab - 1] != 1:
vec[vocab - 1] = 0
print vec
print "\n"
print "************ Vector chech kismi ***************"
check(metin1)
check(metin2)
check(metin3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment