PageRenderTime 177ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/python/engine/PinYin/__init__.py

http://scim-python.googlecode.com/
Python | 70 lines | 17 code | 9 blank | 44 comment | 3 complexity | 72b23a45b43a6ebfe973019664e5ded7 MD5 | raw file
  1. # -*- coding: utf-8 -*-
  2. # vim: set noet ts=4:
  3. #
  4. # scim-python
  5. #
  6. # Copyright (c) 2007-2008 Huang Peng <shawn.p.huang@gmail.com>
  7. #
  8. #
  9. # This library is free software; you can redistribute it and/or
  10. # modify it under the terms of the GNU Lesser General Public
  11. # License as published by the Free Software Foundation; either
  12. # version 2 of the License, or (at your option) any later version.
  13. #
  14. # This library is distributed in the hope that it will be useful,
  15. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. # GNU Lesser General Public License for more details.
  18. #
  19. # You should have received a copy of the GNU Lesser General Public
  20. # License along with this program; if not, write to the
  21. # Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  22. # Boston, MA 02111-1307 USA
  23. #
  24. # $Id: $
  25. #
  26. factorys = []
  27. def get_factorys (config):
  28. global factorys
  29. if len (factorys) == 0:
  30. try:
  31. import PinYin
  32. factorys.append (PinYin.Factory (config))
  33. except:
  34. import traceback
  35. traceback.print_exc ()
  36. try:
  37. import ZhengJu
  38. factorys.append (ZhengJu.ZhengJuFactory (config))
  39. except:
  40. import traceback
  41. traceback.print_exc ()
  42. #~ try:
  43. #~ import ShuangPin
  44. #~ factorys.append (ShuangPin.ShuangPinFactory (config))
  45. #~ except:
  46. #~ import traceback
  47. #~ traceback.print_exc ()
  48. #~
  49. #~ try:
  50. #~ import QuanPin
  51. #~ factorys.append (QuanPin.QuanPinFactory (config))
  52. #~ except:
  53. #~ import traceback
  54. #~ traceback.print_exc ()
  55. #~ try:
  56. #~ import JianPin
  57. #~ factorys.append (JianPin.JianPinFactory (config))
  58. #~ except:
  59. #~ import traceback
  60. #~ traceback.print_exc ()
  61. return factorys