Upload files to ''

This commit is contained in:
Michał Osmulski 2016-11-10 06:33:10 +00:00
parent 2233d7970e
commit 5281208b4b
5 changed files with 102 additions and 0 deletions

8
actions.txt Normal file
View File

@ -0,0 +1,8 @@
pick
put
lift
place
leave
load
unload
transport

50
dictFunctions.py Normal file
View File

@ -0,0 +1,50 @@
monty = ["left", "chess", "back", "load"]
def getWordsSendDict(myList = []):
output = {}
output['Movement'] = checkMovement(myList)
output['Direction'] = checkDirection(myList)
output['Action'] = checkAction(myList)
print(output)
return output
def checkMovement(myList = [], *args):
file = open("movement.txt", 'r')
content = file.readlines()
content = [x.strip('\n') for x in content]
for i in content:
for j in myList:
if j == i:
file.close()
return i
file.close()
def checkDirection(myList = [], *args):
file = open("directions.txt", 'r')
content = file.readlines()
content = [x.strip('\n') for x in content]
for i in content:
for j in myList:
if j == i:
file.close()
return i
file.close()
def checkAction(myList = [], *args):
file = open("actions.txt", 'r')
content = file.readlines()
content = [x.strip('\n') for x in content]
for i in content:
for j in myList:
if j == i:
file.close()
return i
file.close()
def saveDict()
getWordsSendDict(monty)

10
directions.txt Normal file
View File

@ -0,0 +1,10 @@
right
left
forward
backwards
onwards
back
west
east
north
south

7
movement.txt Normal file
View File

@ -0,0 +1,7 @@
go
move
come
travel
proceed
back
head

27
projektkck.py Normal file
View File

@ -0,0 +1,27 @@
dotsfile = open('dots.txt', 'r')
wantedfile = open('wanted.txt', 'r')
def commandStrip(sentence):
for line in dotsfile:
line=line.strip('\n')
sentence = sentence.replace(line, "")
return sentence
def searchKeyWords(sentence):
found = []
for line in wantedfile:
line=line.strip('\n')
if sentence.find(line) >= 0:
found.append(line)
if found:
return found
return 1
temp = commandStrip("Guten tag, ich want you to pick up big red triangle.")
temp = searchKeyWords(temp)
if temp!=1:
print("I have found words: " + " ".join(temp))
dotsfile.close()
wantedfile.close()