1
クラスDictionaryTaggerにあるファイルと並行して処理することはできません。 私はこれを渡すと'dictionary_paths'が定義されていないので、私はエラーを持っている。クラスでは5つのファイル、クラスでスレッドを呼び出す
class DictionaryTagger(object):
print_look = threading.Lock()
def __init__(self, dictionary_paths):
print('Hilo:', threading.current_thread().getName())
files = [open(path, 'r') for path in dictionary_paths]
dictionaries = [yaml.load(dict_file) for dict_file in files]
map(lambda x: x.close(), files)
self.dictionary = {}
self.max_key_size = 0
for curr_dict in dictionaries:
#print(curr_dict)
for key in curr_dict:
#print(type(curr_dict))
#self.dictionary =
if key in self.dictionary:
self.dictionary[key].extend(curr_dict[key])
else:
self.dictionary[key] = curr_dict[key]
self.max_key_size = max(self.max_key_size, len(key))
dictt = DictionaryTagger(['dicts/positive22.yml', 'dicts/negative22.yml', 'dicts/increasers.yml', 'dicts/decreasers.yml', 'dicts/inverter.yml'])
を渡します
for i in range(3):
t = threading.Thread(target=DictionaryTagger)
t.demond = True
t.start()
のinit(1)行方不明に位置引数を必要:のinit機能を使用すると、引数として定義されているため