def __iter__(self):
    print(('Running Iteration #%s' % iterationCounter['val']))
    iterationCounter['val'] += 1
    for fname in open(pathsLocator, mode='rt'):
        sentencesPath = fname.rstrip(newline)
        if sentencesPath.startswith(ignorePrefix):
            continue
        now = datetime.datetime.now()
        print(('[%s] Grabbing sentences from: %s' % (now.strftime('%Y-%m-%d %H:%M'), sentencesPath)))
        try:
            for line in open(sentencesPath, mode='rt'):
                sentence = line.rstrip(newline).split(hopSeparator)
                for tokenPos in range(len(sentence)):
                    token = sentence[tokenPos]
                    sentence[tokenPos] = entity_mapping_dict.get(token, token)
                (yield sentence)
        except Exception:
            print('Failed reading file:')
            print(sentencesPath)
def __iter__(self):
    print(('Running Iteration #%s' % iterationCounter['val']))
    iterationCounter['val'] += 1
    for fname in open(pathsLocator, mode='rt'):
        sentencesPath = fname.rstrip(newline)
        if sentencesPath.startswith(ignorePrefix):
            continue
        now = datetime.datetime.now()
        print(('[%s] Grabbing sentences from: %s' % (now.strftime('%Y-%m-%d %H:%M'), sentencesPath)))
        try:
            for line in open(sentencesPath, mode='rt'):
                sentence = line.rstrip(newline).split(hopSeparator)
                for tokenPos in range(len(sentence)):
                    token = sentence[tokenPos]
                    sentence[tokenPos] = entity_mapping_dict.get(token, token)
                (yield sentence)
        except Exception:
            print('Failed reading file:')
            print(sentencesPath)