Commit 127210d9ee1e021f494090758db5d8b7f6cd8b42

Authored by Killian
1 parent 2e75fdc6c4
Exists in soap

Suppression du phon

Showing 3 changed files with 28 additions and 50 deletions Side-by-side Diff

... ... @@ -31,6 +31,6 @@
31 31 # supposed to use it in production.
32 32 from wsgiref.simple_server import make_server
33 33  
34   - server = make_server('192.168.75.140', 9000, wsgi_app)
  34 + server = make_server('127.0.0.1', 9000, wsgi_app)
35 35 server.serve_forever()
... ... @@ -8,11 +8,9 @@
8 8 def __init__(self,dirtyString):
9 9 self.lem=u""
10 10 self.tagger=Tagger()
11   - self.phoner=Phoner()
12 11 self.dico ={}
13 12 self.string=dirtyString
14 13 def isReady(self):
15   - self.phoner.isReady()
16 14 self.tagger.isReady()
17 15 def __unicode__(self):
18 16 string = u""
... ... @@ -20,9 +18,6 @@
20 18 string += ( unicode(word.decode("utf-8")))+unicode (u";")
21 19 for lemWord in self.dico[word][0]:
22 20 string += (unicode(lemWord.decode("utf-8"))+ unicode(u" "))
23   - string +=u";"
24   - for phonWord in self.dico[word][1]:
25   - string += (unicode(phonWord.decode("utf-8"))+ unicode(u" "))
26 21 string+=u"\n"
27 22 return string
28 23 def clean(self):
29 24  
... ... @@ -41,24 +36,9 @@
41 36 self.dico[table[0]]=[set(),set()]
42 37 self.dico[table[0]][0].add(table[2])
43 38 self.lem = self.lem +"\n"+ table[2]
44   - def insertPhon(self):
45   - prephonedString=self.cleanString + self.lem.rstrip()
46   - phonedString=self.phoner.phon(self.cleanString.rstrip() +self.lem.rstrip())
47   - self.tablephon= phonedString.rstrip().split("\n")
48   - for line in phonedString.rstrip().split("\n"):
49   - if not re.match(r's>',line):
50   - table = line.rstrip().split(" ")
51   - if table[0] in self.dico and not table[1].isspace() :
52   - self.dico[table[0]][1].add(table[1])
53   - elif table[0] not in self.dico and not table[1].isspace() :
54   - for mot,sets in self.dico.iteritems():
55   - if table[0] in sets[0]:
56   - self.dico[mot][1].add(table[1])
57   -
58 39 def getDico(self):
59 40 self.clean()
60 41 self.insertLem()
61   - self.insertPhon()
62 42 self.table=[]
63 43 for i,v in self.dico.iteritems():
64 44 if not re.match(r".s>",i):
65 45  
... ... @@ -66,10 +46,7 @@
66 46 list.append(i)
67 47 for indice in v[0]:
68 48 list.append(indice)
69   - for indice in v[1]:
70   - list.append(indice)
71 49 ligne= " ".join(list)
72   -
73 50 self.table.append(ligne)
74 51 return "\n".join(self.table)
test/functional/testLiaSoap.py
... ... @@ -3,7 +3,7 @@
3 3 import threading
4 4  
5 5 ### TODO : Tester en parallele x4 un million de fois pour voir ###
6   -url = 'http://194.57.216.156:8181/?wsdl'
  6 +url = 'http://127.0.0.1:9000/?wsdl'
7 7 client = Client(url)
8 8 filename = "data.txt"
9 9 file = open(filename, "r")
10 10  
... ... @@ -11,34 +11,35 @@
11 11 # Exp 1
12 12 debut =time.time()
13 13 contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip()
14   -client.service.get_phon(contents)
  14 +res =client.service.get_phon(contents)
  15 +print(res)
15 16 duree= time.time()- debut
16 17 print (" Exper 1 : " + str(duree))
17 18 # Exp 2
18   -debut =time.time()
19   -file.seek(0)
20   -lines = file.readlines()
21   -for line in lines:
22   - line = line.decode("utf8").encode("ascii", errors='ignore').rstrip()
23   - if line is not None:
24   - try:
25   - client.service.get_phon(line)
26   - except:
27   - continue
28   -duree= time.time()- debut
29   -print (" Exper 2 line by line 1 corpus : " + str(duree))
30   -##Exp 3
31   -debut = time.time()
32   -file.seek(0)
33   -contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip()
34   -tabs=[]
35   -i=0
36   -while i <= nb_times :
37   - tabs.append(contents)
38   - i+=1
39   -client.service.get_phon("".join(tabs))
40   -duree= time.time()- debut
41   -print ("Exper 3 2pow4 time the content in once shot " + str(duree))
  19 +#debut =time.time()
  20 +#file.seek(0)
  21 +#lines = file.readlines()
  22 +#for line in lines:
  23 +# line = line.decode("utf8").encode("ascii", errors='ignore').rstrip()
  24 +# if line is not None:
  25 +# try:
  26 +# client.service.get_phon(line)
  27 +# except:
  28 +# continue
  29 +#duree= time.time()- debut
  30 +#print (" Exper 2 line by line 1 corpus : " + str(duree))
  31 +###Exp 3
  32 +#debut = time.time()
  33 +#file.seek(0)
  34 +#contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip()
  35 +#tabs=[]
  36 +#i=0
  37 +#while i <= nb_times :
  38 +# tabs.append(contents)
  39 +# i+=1
  40 +#client.service.get_phon("".join(tabs))
  41 +#duree= time.time()- debut
  42 +#print ("Exper 3 2pow4 time the content in once shot " + str(duree))
42 43 # EXP 4
43 44 #debut = time.time()
44 45 #contents = file.read().decode("utf8").encode("ascii", errors='ignore').rstrip()