Package medite :: Package MediteAppli :: Module mediteFeng
[hide private]
[frames] | no frames]

Source Code for Module medite.MediteAppli.mediteFeng

 1  # -*- coding: iso-8859-1 -*- 
 2  # Copyright 20003 - 2008: Julien Bourdaillet (julien.bourdaillet@lip6.fr), Jean-Gabriel Ganascia (jean-gabriel.ganascia@lip6.fr) 
 3  # This file is part of MEDITE. 
 4  # 
 5  #    MEDITE is free software; you can redistribute it and/or modify 
 6  #    it under the terms of the GNU General Public License as published by 
 7  #    the Free Software Foundation; either version 2 of the License, or 
 8  #    (at your option) any later version. 
 9  # 
10  #    MEDITE is distributed in the hope that it will be useful, 
11  #    but WITHOUT ANY WARRANTY; without even the implied warranty of 
12  #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
13  #    GNU General Public License for more details. 
14  # 
15  #    You should have received a copy of the GNU General Public License 
16  #    along with Foobar; if not, write to the Free Software 
17  #    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
18   
19  from Donnees.resultatAppli import * 
20  from feng import * 
21  import synthetic 
22   
23   
24 -class fengAlgoMedite:
25 """ Classe servant à appeler l'algo de Feng depuis Medite dans cMedite.py et ijcai.py"""
26 - def __init__(self, texte1,texte2,p2,pcaseSensitive, pseparatorSensivitive, pdiacriticSensitive,planTravail,calculDep=True):
27 28 self.texte1 = texte1 29 self.texte2 = texte2 30 self.planTravail = planTravail 31 self.bbl = None 32 self.feng = algoFeng(texte1, texte2, not pseparatorSensivitive, not pcaseSensitive, not pdiacriticSensitive, p2,calculDep=calculDep)
33
34 - def run(self):
35 36 (res1, res2), (sup1, aj2), (dep1, dep2), (coresDep),(remp1,remp2) = self.feng.aligne() 37 lt= len(self.texte1) 38 #formatage du resultat pour etre compatible avec la classe Resultat 39 for i in xrange(len(res2)): 40 res2[i] = (res2[i][0]+lt, res2[i][1]+lt) 41 for i in xrange(len(aj2)): 42 aj2[i] = (aj2[i][0]+lt, aj2[i][1]+lt) 43 44 for i in xrange(len(dep2)): 45 dep2[i] = (dep2[i][0]+lt, dep2[i][1]+lt) 46 for i in xrange(len(remp2)): 47 remp2[i] = (remp2[i][0]+lt, remp2[i][1]+lt) 48 for i in xrange(len(coresDep)): 49 tmpCores0=coresDep[i][0] 50 tmpCores1=(coresDep[i][1][0]+lt,coresDep[i][1][1]+lt) 51 coresDep[i]=(tmpCores0,tmpCores1) 52 53 remp1.extend(remp2) 54 dep1.extend(dep2) 55 56 res1.extend(res2) 57 58 resultat = Resultat(aj2, sup1, dep1, remp1, lt, self.texte1+self.texte2, res1, coresDep) 59 self.bbl = synthetic.BiBlocListWD(resultat,self.planTravail) 60 res = self.bbl.toResultat() 61 return res
62