Example #1
0
    def __init__(self):

        Processor.__init__(self)
        self.windowSize = 0
        self.conservationLimit = 0.0
        self.desiredSpeciesList = []
        self.algorithm = BlockProcessor.ALGORITHM_OCCURENCE_RATIO_VALUE
 def __init__(self):
     Processor.__init__(self)
     self.mapping = {0: 'irrelevant', 1: 'related'}
     self.path = root_path
     self.nb_model = irr_naive_bayes
     self.tf_idf_vec = pickle.load(
         open(os.path.join(self.path, "model/NB_relevant/tf_idf_vec.pkl"),
              "rb"))
Example #3
0
 def __init__(self):
     Processor.__init__(self)
     self.desiredSpeciesList = []
     self.referenceSpecies = None
     self.bedSequencesDict = None
     self.mafBlockDic = {}
     self.parsedSpeciesList = []
     self.threadLock = None
Example #4
0
 def __init__(self,
              index_elasic,
              num_of_fields=3,
              jaccard_measure=0.8,
              similarity_threshold=0.9):
     Processor.__init__(self)
     self.num_of_fields = num_of_fields
     self.jaccard_measure = jaccard_measure
     self.similarity_threshold = similarity_threshold
     self.clean_news_normalize = []
     self.clean_news_index = []
     self.soft_tf_idf = []
     self.index = index_elasic
     self.last_size = -1
Example #5
0
	def __init__(self, logger, sock = None, addr = None, status = 'started', sniffer = None):
		self._status = status
		self._sock = sock		
		self._logger = logger
		self._addr = addr
		self._sniffer = sniffer
		self._wlock = threading.RLock()
		self._writeQueue = []
		self._readProcessor = Processor()
		self._writeProcessor = Processor(2)

		if self._sock:
			self._sock.settimeout(5)
			self.__startToHandleMsg()	
Example #6
0
def main():
    processor = Processor()
    print(Console.start.__doc__)
    decoder = Decoder(processor)

    console = Console(decoder)

    console.start()
Example #7
0
 def __init__(self):
     Processor.__init__(self)
     self.mapping = {
         0: 'Công nghệ',
         1: 'Giáo dục',
         2: 'Giải trí',
         3: 'Khoa học',
         4: 'Kinh tế',
         5: 'Pháp luật',
         6: 'Thế giới',
         7: 'Thể thao',
         8: 'Văn hóa',
         9: 'Xã hội',
         10: 'Y tế'
     }
     self.path = root_path
     self.bi_rnn_model = bi_rnn
     self.tf_idf_vec = pickle.load(
         open(os.path.join(self.path, "model/tf_idf_vec.pkl"), "rb"))
 def __init__( self):
     Processor.__init__( self)
     self.outPath = ""
 def __init__(self):
     Processor.__init__(self)
Example #10
0
 def __init__(self):
     Processor.__init__(self)
     self.name = "ProcessorByKeyAndPattern_TalentInfo"
     self.keywords = ["Salary", "Environment", "Regime"]
 def __init__(self):
     Processor.__init__(self)
     self.aho_cora_dict = ahocorasick.Automaton()
     self.keyword = []
     self.initialization()
Example #12
0
class Connection:
	
	def __init__(self, logger, sock = None, addr = None, status = 'started', sniffer = None):
		self._status = status
		self._sock = sock		
		self._logger = logger
		self._addr = addr
		self._sniffer = sniffer
		self._wlock = threading.RLock()
		self._writeQueue = []
		self._readProcessor = Processor()
		self._writeProcessor = Processor(2)

		if self._sock:
			self._sock.settimeout(5)
			self.__startToHandleMsg()	

		#self._thread = threading.Thread(target=self.read)
		#self._thread.start()

	def __startToHandleMsg(self):
		if self._sniffer:
			self._sniffer.registSock(self._sock, self.read, self.writeImpl, self.shutdown)
		else:
			self._readProcessor.start()
			self._readProcessor.process(self.read)
			self._writeProcessor.start()
			self._writeProcessor.process(self.writeImpl)

	def connect(self, host, port):
		self._sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		self._addr = (host, port)
		self._sock.connect(self._addr)
		self._status = 'started'	
		self._sock.settimeout(5)
		self.__startToHandleMsg()

	def stop(self):
		self._status = 'stopped'
		self._sock.close()
		
	def read(self):
		while self._status != 'stopped':
			try:
				buf = self._sock.recv(4096)
				if len(buf) == 0:
					self._logger.debug("[read]buf:%s" % (buf))
					raise socket.timeout
				self._logger.debug("[read]bufLen:%d\nbuffer:\n%s\n" % (len(buf), buf))
				#
				self.write(buf)
			except socket.error, e:
				if (str(e) == "timed out"):
					self._logger.debug("[read]time out!")
					if self._sniffer:
						return self._sniffer.registSock(self._sock, self.read, None, None)
					time.sleep(0.1)
				else:
					self._logger.debug("[read]socket.error!" + str(e))
					return self.shutdown()


		print "recv done"
Example #13
0
from gui import GUI
from mainmem.MainMemory import MainMemory
from processor.Processor import Processor
from bus.Bus import Bus
import threading

mainMem = MainMemory(16)

gui = GUI.GUI()

lock = threading.Lock()
proc1 = Processor(1, mainMem.getAvailableAddresses(), lock, gui)
proc2 = Processor(2, mainMem.getAvailableAddresses(), lock, gui)
proc3 = Processor(3, mainMem.getAvailableAddresses(), lock, gui)
proc4 = Processor(4, mainMem.getAvailableAddresses(), lock, gui)

bus = Bus([proc1, proc2, proc3, proc4], mainMem)

t1 = threading.Thread(target=proc1.startProcessor, args=(bus, ))
t2 = threading.Thread(target=proc2.startProcessor, args=(bus, ))
t3 = threading.Thread(target=proc3.startProcessor, args=(bus, ))
t4 = threading.Thread(target=proc4.startProcessor, args=(bus, ))
t1.start()
t2.start()
t3.start()
t4.start()

gui.setMemInitialValues(mainMem.memBlocks)
gui.startGUI()
 def __init__(self):
     Processor.__init__( self)
     self.referenceSpecies = ""
 def __init__(self):
     Processor.__init__(self)
     self.path = root_path
     self.svm_model = cate_svm
     self.tf_idf_vec = pickle.load(
         open(os.path.join(self.path, "model/tf_idf_vec.pkl"), "rb"))