def data_input(self): self.dialogue_structure = read_utterance("../questions/TOPIC_" + str(self.TOPIC_ID) + "/dialogue_structure.csv") self.utterance_database = [] for x in self.dialogue_structure: temp = read_utterance("../questions/TOPIC_" + str(self.TOPIC_ID) + "/q_" + str(x["q_num"]) + ".csv") self.utterance_database.append(temp) self.ending_utterance = read_utterance("../questions/TOPIC_" + str(self.TOPIC_ID) + "/ending.csv") self.backchanneling_database = read_utterance( "../peripheral/backchanneling.csv") self.facilitation_database = read_utterance( "../peripheral/facilitation.csv") self.pass_to_others_database = read_utterance( "../peripheral/pass_to_others.csv") self.conjunction_database = [] self.conjunction_classes = [ "0_junsetsu", "1_gyakusetsu", "2_heiretsu", "3_taichi", "4_tenkan", "5_matome", "6_kyomu" ] for x in self.conjunction_classes: temp = read_utterance("../peripheral/" + str(x) + ".csv") self.conjunction_database.append(temp)
# -*- coding: utf-8 -*- import sys import socket from socket import error as socket_error import time from data_import import read_utterance hosts = read_utterance("../network/commu_data.csv") if __name__ == '__main__': clients = [] for clientdata in hosts: host = clientdata["host"] port = clientdata["port"] try: for res in socket.getaddrinfo(host, port, socket.AF_UNSPEC, socket.SOCK_STREAM): af, socktype, proto, canonname, sa = res try: sock = socket.socket(af, socktype, proto) clients.append(sock) except OSError as msg: sock = None continue try: sock.connect(sa) except OSError as msg: sock.close() sock = None continue