From f025bb315f0c4a0a4210558d3269e575ea0c2695 Mon Sep 17 00:00:00 2001 From: Wannaphong Date: Fri, 31 Mar 2017 22:53:05 +0700 Subject: [PATCH] delete six.u --- pythainlp/number/__init__.py | 22 +++++++++++----------- pythainlp/segment/pyicu.py | 4 ++-- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/pythainlp/number/__init__.py b/pythainlp/number/__init__.py index 01e7d0c9b..dadfdab7a 100644 --- a/pythainlp/number/__init__.py +++ b/pythainlp/number/__init__.py @@ -4,16 +4,16 @@ from builtins import dict from builtins import int import math,six -p = [['ภาษาไทย', 'ตัวเลข','เลขไทย'], - ['หนึ่ง', '1', '๑'], - ['สอง', '2', '๒'], - ['สาม', '3', '๓'], - ['สี่', '4', '๔'], - ['ห้า', '5', '๕'], - ['หก', '6', '๖'], - ['หก', '7', '๗'], - ['แปด', '8', '๘'], - ['เก้า', '9', '๙']] +p = [[u'ภาษาไทย', u'ตัวเลข',u'เลขไทย'], + [u'หนึ่ง', u'1', u'๑'], + [u'สอง', u'2', u'๒'], + [u'สาม', u'3', u'๓'], + [u'สี่', u'4', u'๔'], + [u'ห้า', u'5', u'๕'], + [u'หก', u'6', u'๖'], + [u'หก', u'7', u'๗'], + [u'แปด', u'8', u'๘'], + [u'เก้า', u'9', u'๙']] thaitonum = dict((x[2], x[1]) for x in p[1:]) p1 = dict((x[0], x[1]) for x in p[1:]) d1 = 0 @@ -71,7 +71,7 @@ def numtowords(amount_number): ret += satang + "สตางค์" else: ret += "ถ้วน" - return six.u(ret) + return ret #อ่านจำนวนตัวเลขภาษาไทย def ReadNumber(number): diff --git a/pythainlp/segment/pyicu.py b/pythainlp/segment/pyicu.py index d748096fb..b257acd6a 100644 --- a/pythainlp/segment/pyicu.py +++ b/pythainlp/segment/pyicu.py @@ -1,11 +1,11 @@ # -*- coding: utf-8 -*- from __future__ import absolute_import,print_function,unicode_literals from itertools import groupby -import PyICU,six +import PyICU def segment(txt): """รับค่า ''str'' คืนค่าออกมาเป็น ''list'' ที่ได้มาจากการตัดคำโดย ICU""" bd = PyICU.BreakIterator.createWordInstance(PyICU.Locale("th")) - bd.setText(six.u(txt)) + bd.setText(txt) breaks = list(bd) return [txt[x[0]:x[1]] for x in zip([0]+breaks, breaks)] if __name__ == "__main__":