# -*- coding: iso-8859-1 -*- # Copyright 20003 - 2008: Julien Bourdaillet (julien.bourdaillet@lip6.fr), Jean-Gabriel Ganascia (jean-gabriel.ganascia@lip6.fr) # This file is part of MEDITE. # # MEDITE is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # MEDITE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Foobar; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from Donnees.resultatAppli import * from feng import * import synthetic class fengAlgoMedite: """ Classe servant à appeler l'algo de Feng depuis Medite dans cMedite.py et ijcai.py""" def __init__(self, texte1,texte2,p2,pcaseSensitive, pseparatorSensivitive, pdiacriticSensitive,planTravail,calculDep=True): self.texte1 = texte1 self.texte2 = texte2 self.planTravail = planTravail self.bbl = None self.feng = algoFeng(texte1, texte2, not pseparatorSensivitive, not pcaseSensitive, not pdiacriticSensitive, p2,calculDep=calculDep) def run(self): (res1, res2), (sup1, aj2), (dep1, dep2), (coresDep),(remp1,remp2) = self.feng.aligne() lt= len(self.texte1) #formatage du resultat pour etre compatible avec la classe Resultat for i in xrange(len(res2)): res2[i] = (res2[i][0]+lt, res2[i][1]+lt) for i in xrange(len(aj2)): aj2[i] = (aj2[i][0]+lt, aj2[i][1]+lt) for i in xrange(len(dep2)): dep2[i] = (dep2[i][0]+lt, dep2[i][1]+lt) for i in xrange(len(remp2)): remp2[i] = (remp2[i][0]+lt, remp2[i][1]+lt) for i in xrange(len(coresDep)): tmpCores0=coresDep[i][0] tmpCores1=(coresDep[i][1][0]+lt,coresDep[i][1][1]+lt) coresDep[i]=(tmpCores0,tmpCores1) remp1.extend(remp2) dep1.extend(dep2) res1.extend(res2) resultat = Resultat(aj2, sup1, dep1, remp1, lt, self.texte1+self.texte2, res1, coresDep) self.bbl = synthetic.BiBlocListWD(resultat,self.planTravail) res = self.bbl.toResultat() return res