Skip to content

Commit

Permalink
Fix the NoneType related errors inside the learning script
Browse files Browse the repository at this point in the history
  • Loading branch information
mertyildiran committed Oct 16, 2017
1 parent a80a69c commit 39db007
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dragonfire/learn.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ def db_getter(self,subject):
first_verbtense = False
for key, value in dictionary.iteritems(): # iterate over the dictionary defined and assigned on above
if not first_verbtense: # if the first verbtense assignment does not made yet
answer += ' ' + key # concatenate with a whitespace
answer += ' ' + str(key) # concatenate with a whitespace
first_verbtense = True
else:
answer += ', ' + key # otherwise concatenate with a comma + whitespace
answer += ', ' + str(key) # otherwise concatenate with a comma + whitespace
first_clause = False
for clause in value: # iterate over the clauses of the key
if not first_clause: # if the first verbtense assignment does not made yet
Expand Down Expand Up @@ -117,7 +117,8 @@ def mirror(self,answer):
def pronoun_fixer(self,subject): # TODO: Extend the context of this function
subject = subject.upper()
if 'YOURSELF' in subject:
return subject.replace('YOURSELF','YOU')
subject = subject.replace('YOURSELF','YOU')
return subject


if __name__ == "__main__":
Expand Down

0 comments on commit 39db007

Please sign in to comment.