diff --git a/liaSoap.py b/liaSoap.py index e4e784e..7359d32 100644 --- a/liaSoap.py +++ b/liaSoap.py @@ -31,5 +31,5 @@ if __name__ == '__main__': # supposed to use it in production. from wsgiref.simple_server import make_server - server = make_server('192.168.75.140', 9000, wsgi_app) + server = make_server('127.0.0.1', 9000, wsgi_app) server.serve_forever() diff --git a/processor/Orkis.py b/processor/Orkis.py index c1f588b..b55b30e 100644 --- a/processor/Orkis.py +++ b/processor/Orkis.py @@ -8,11 +8,9 @@ class Orkis(baseProcessor): def __init__(self,dirtyString): self.lem=u"" self.tagger=Tagger() - self.phoner=Phoner() self.dico ={} self.string=dirtyString def isReady(self): - self.phoner.isReady() self.tagger.isReady() def __unicode__(self): string = u"" @@ -20,9 +18,6 @@ class Orkis(baseProcessor): string += ( unicode(word.decode("utf-8")))+unicode (u";") for lemWord in self.dico[word][0]: string += (unicode(lemWord.decode("utf-8"))+ unicode(u" ")) - string +=u";" - for phonWord in self.dico[word][1]: - string += (unicode(phonWord.decode("utf-8"))+ unicode(u" ")) string+=u"\n" return string def clean(self): @@ -41,24 +36,9 @@ class Orkis(baseProcessor): self.dico[table[0]]=[set(),set()] self.dico[table[0]][0].add(table[2]) self.lem = self.lem +"\n"+ table[2] - def insertPhon(self): - prephonedString=self.cleanString + self.lem.rstrip() - phonedString=self.phoner.phon(self.cleanString.rstrip() +self.lem.rstrip()) - self.tablephon= phonedString.rstrip().split("\n") - for line in phonedString.rstrip().split("\n"): - if not re.match(r's>',line): - table = line.rstrip().split(" ") - if table[0] in self.dico and not table[1].isspace() : - self.dico[table[0]][1].add(table[1]) - elif table[0] not in self.dico and not table[1].isspace() : - for mot,sets in self.dico.iteritems(): - if table[0] in sets[0]: - self.dico[mot][1].add(table[1]) - def getDico(self): self.clean() self.insertLem() - self.insertPhon() self.table=[] for i,v in self.dico.iteritems(): if not re.match(r".s>",i): @@ -66,9 +46,6 @@ class Orkis(baseProcessor): list.append(i) for indice in v[0]: list.append(indice) - for indice in v[1]: - list.append(indice) ligne= " ".join(list) - self.table.append(ligne) return "\n".join(self.table) diff --git a/test/functional/testLiaSoap.py b/test/functional/testLiaSoap.py index 5961337..0cfd934 100644 --- a/test/functional/testLiaSoap.py +++ b/test/functional/testLiaSoap.py @@ -3,7 +3,7 @@ import time import threading ### TODO : Tester en parallele x4 un million de fois pour voir ### -url = 'http://194.57.216.156:8181/?wsdl' +url = 'http://127.0.0.1:9000/?wsdl' client = Client(url) filename = "data.txt" file = open(filename, "r") @@ -11,34 +11,35 @@ nb_times=4 # Exp 1 debut =time.time() contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip() -client.service.get_phon(contents) +res =client.service.get_phon(contents) +print(res) duree= time.time()- debut print (" Exper 1 : " + str(duree)) # Exp 2 -debut =time.time() -file.seek(0) -lines = file.readlines() -for line in lines: - line = line.decode("utf8").encode("ascii", errors='ignore').rstrip() - if line is not None: - try: - client.service.get_phon(line) - except: - continue -duree= time.time()- debut -print (" Exper 2 line by line 1 corpus : " + str(duree)) -##Exp 3 -debut = time.time() -file.seek(0) -contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip() -tabs=[] -i=0 -while i <= nb_times : - tabs.append(contents) - i+=1 -client.service.get_phon("".join(tabs)) -duree= time.time()- debut -print ("Exper 3 2pow4 time the content in once shot " + str(duree)) +#debut =time.time() +#file.seek(0) +#lines = file.readlines() +#for line in lines: +# line = line.decode("utf8").encode("ascii", errors='ignore').rstrip() +# if line is not None: +# try: +# client.service.get_phon(line) +# except: +# continue +#duree= time.time()- debut +#print (" Exper 2 line by line 1 corpus : " + str(duree)) +###Exp 3 +#debut = time.time() +#file.seek(0) +#contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip() +#tabs=[] +#i=0 +#while i <= nb_times : +# tabs.append(contents) +# i+=1 +#client.service.get_phon("".join(tabs)) +#duree= time.time()- debut +#print ("Exper 3 2pow4 time the content in once shot " + str(duree)) # EXP 4 #debut = time.time() #contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip()