/[ambar]/ambar/utils.py
ViewVC logotype

Diff of /ambar/utils.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by amoyav, Sun Apr 21 12:48:18 2002 UTC revision 1.9 by amoyav, Thu May 9 05:31:17 2002 UTC
# Line 103  def extraer_id(string): Line 103  def extraer_id(string):
103      """Extrae un id de dentro de un texto descriptivo.      """Extrae un id de dentro de un texto descriptivo.
104    
105      Si el texto contiene un par de corchetes, el id es lo que hay entre ellos      Si el texto contiene un par de corchetes, el id es lo que hay entre ellos
106      (por ejemplo, 'un simple [paseante]'). Si no, el id es la primera palabra.      (por ejemplo, 'un simple [paseante]'). Si no, el id es la primera palabra
107        que no sea un artículo (el, la, los, las, un, uno, una, unos, unas).
108      """      """
109      if len(string) == 0:      if len(string) == 0:
110          return ""          return ""
# Line 113  def extraer_id(string): Line 114  def extraer_id(string):
114          if ind_abrir != -1 and ind_cerrar != -1:          if ind_abrir != -1 and ind_cerrar != -1:
115              return string[ind_abrir+1 : ind_cerrar]              return string[ind_abrir+1 : ind_cerrar]
116          else:          else:
117              return string.split()[0]              for palabra in string.split():
118                    if not palabra.lower() in ["el", "la", "los", "las", "un", "uno", "una", "unos", "unas"]:
119                        return palabra
120                return "no tiene id"
121    
122    
123  def escribir_excepcion():  def escribir_excepcion():

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26