[python-mecab] Use upstream test.py
Mamoru Tasaka
mtasaka at fedoraproject.org
Sat Jan 14 16:57:59 UTC 2012
commit e64fd71b8a38e8006a812010b0385fe32cd59644
Author: Mamoru Tasaka <tasaka1 at localhost.localdomain>
Date: Sun Jan 15 01:57:54 2012 +0900
Use upstream test.py
mecab-python-0.991-test.py | 61 +++++++++++++++++++++++++++++++++++++++
python-mecab-0.99-testfix.patch | 20 -------------
python-mecab.spec | 16 +++++-----
3 files changed, 69 insertions(+), 28 deletions(-)
---
diff --git a/mecab-python-0.991-test.py b/mecab-python-0.991-test.py
new file mode 100644
index 0000000..d444200
--- /dev/null
+++ b/mecab-python-0.991-test.py
@@ -0,0 +1,61 @@
+#!/usr/bin/python
+# -*- coding:utf-8 -*-
+
+import MeCab
+import sys
+import string
+
+sentence = "太郎はこの本を二郎を見た女性に渡した。"
+
+try:
+
+ print MeCab.VERSION
+
+ model = MeCab.Model(" ".join(sys.argv))
+ c = model.createTagger()
+
+ print c.parse(sentence)
+
+ m = c.parseToNode(sentence)
+ while m:
+ print m.surface, "\t", m.feature
+ m = m.next
+ print "EOS"
+
+ lattice = MeCab.Lattice()
+ lattice.set_sentence(sentence)
+
+ c.parse(lattice)
+ len = lattice.size()
+ for i in range(len + 1):
+ b = lattice.begin_nodes(i)
+ e = lattice.end_nodes(i)
+ while b:
+ print "B[%d] %s\t%s" % (i, b.surface, b.feature)
+ b = b.bnext
+ while e:
+ print "E[%d] %s\t%s" % (i, e.surface, e.feature)
+ e = e.bnext
+ print "EOS"
+
+ lattice.set_sentence(sentence)
+ lattice.set_request_type(MeCab.MECAB_NBEST)
+ c.parse(lattice)
+ for i in range(10):
+ lattice.next()
+ print lattice.toString()
+
+ d = c.dictionary_info()
+ while d:
+ print "filename: %s" % d.filename
+ print "charset: %s" % d.charset
+ print "size: %d" % d.size
+ print "type: %d" % d.type
+ print "lsize: %d" % d.lsize
+ print "rsize: %d" % d.rsize
+ print "version: %d" % d.version
+ d = d.next
+
+except RuntimeError, e:
+ print "RuntimeError:", e;
+
diff --git a/python-mecab.spec b/python-mecab.spec
index e6c63ea..9a56667 100644
--- a/python-mecab.spec
+++ b/python-mecab.spec
@@ -1,6 +1,6 @@
%define mainver 0.991
#%%define betaver pre3
-%define relnumber 1
+%define relnumber 2
%define srcname mecab-python
%{!?python_sitearch: %global python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
@@ -16,7 +16,8 @@ License: BSD or LGPLv2+ or GPL+
URL: http://mecab.sourceforge.net/
Source0: http://mecab.googlecode.com/files/%{srcname}-%{mainver}%{?betaver}.tar.gz
#http://code.google.com/p/mecab/issues/detail?id=1
-Patch0: python-mecab-0.99-testfix.patch
+#Patch0: python-mecab-0.99-testfix.patch
+Source1: mecab-python-0.991-test.py
# This is not release number specific
BuildRequires: mecab-devel = %{version}
@@ -31,7 +32,8 @@ Requires: mecab = %{version}
%prep
%setup -q -n %{srcname}-%{version}%{?betaver}
-%patch0 -p1
+#%%patch0 -p1
+cp -p %{SOURCE1} ./test.py
%build
export CXXFLAGS=$RPM_OPT_FLAGS
@@ -42,11 +44,6 @@ export CXXFLAGS=$RPM_OPT_FLAGS
--root $RPM_BUILD_ROOT
%check
-%{__sed} -i.encoding -e '1s|^\(.*\)$|\1\n# coding=UTF-8|' \
- test.py
-rmdir tmpdir || :
-%{__mkdir} tmpdir ; cd tmpdir ; %{__cp} -p ../test.py .
-
PYTHONPATH=$RPM_BUILD_ROOT%{python_sitearch} %{__python} test.py
cd ..
@@ -61,6 +58,9 @@ cd ..
%endif
%changelog
+* Sun Jan 15 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 0.991-2
+- Use upstream test.py
+
* Sun Jan 15 2012 Mamoru Tasaka <mtasaka at fedoraproject.org> - 0.991-1
- 0.991
More information about the scm-commits
mailing list