summaryrefslogtreecommitdiff
path: root/dev-python/mecab-python/files/mecab-python-python3.patch
blob: d8fa167fff174b13328c6af3e7f63792de5afc28 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
--- a/setup.py
+++ b/setup.py
@@ -7,7 +7,7 @@
     return os.popen(str).readlines()[0][:-1]

 def cmd2(str):
-    return string.split (cmd1(str))
+    return cmd1(str).split()

 setup(name = "mecab-python",
 	version = cmd1("mecab-config --version"),
--- a/test.py
+++ b/test.py
@@ -9,17 +9,17 @@

 try:

-    print MeCab.VERSION
+    print(MeCab.VERSION)

     t = MeCab.Tagger (" ".join(sys.argv))

-    print t.parse(sentence)
+    print(t.parse(sentence))

     m = t.parseToNode(sentence)
     while m:
-	print m.surface, "\t", m.feature
-	m = m.next
-    print "EOS"
+        print(m.surface, "\t", m.feature)
+        m = m.next
+    print("EOS")
     
     lattice = MeCab.Lattice()
     t.parse(lattice)
@@ -29,24 +29,24 @@
         b = lattice.begin_nodes(i)
         e = lattice.end_nodes(i)
         while b:
-            print "B[%d] %s\t%s" % (i, b.surface, b.feature)
+            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)
+            print("E[%d] %s\t%s" % (i, e.surface, e.feature))
             e = e.bnext 
-    print "EOS";
+    print("EOS");

     d = t.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
+        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;
+except RuntimeError as e:
+    print("RuntimeError:", e);