質問編集履歴
4
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,31 +30,33 @@
|
|
30
30
|
|
31
31
|
import re
|
32
32
|
|
33
|
+
import numpy as np
|
34
|
+
|
33
35
|
|
34
36
|
|
35
37
|
with open(path) as f:
|
36
38
|
|
37
|
-
|
39
|
+
data = f.read()
|
38
40
|
|
39
41
|
|
40
42
|
|
41
|
-
|
43
|
+
mecab = MeCab.Tagger()
|
42
44
|
|
43
|
-
|
45
|
+
parse = mecab.parse(data)
|
44
46
|
|
45
|
-
|
47
|
+
lines = parse.split('\n')
|
46
48
|
|
47
|
-
|
49
|
+
items = (re.split('[\t,]', line) for line in lines)
|
48
50
|
|
49
51
|
|
50
52
|
|
51
|
-
|
53
|
+
words = [item[0]
|
52
54
|
|
53
|
-
|
55
|
+
for item in items
|
54
56
|
|
55
|
-
|
57
|
+
if (item[0] not in ('EOS', '', 't', 'ー') and
|
56
58
|
|
57
|
-
|
59
|
+
item[1] == '名詞' and item[2] == '一般')]
|
58
60
|
|
59
61
|
|
60
62
|
|
@@ -64,7 +66,7 @@
|
|
64
66
|
|
65
67
|
for word in words:
|
66
68
|
|
67
|
-
|
69
|
+
noun = np.append(noun, word)
|
68
70
|
|
69
71
|
|
70
72
|
|
3
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -25,6 +25,12 @@
|
|
25
25
|
|
26
26
|
|
27
27
|
```python
|
28
|
+
|
29
|
+
import mecab
|
30
|
+
|
31
|
+
import re
|
32
|
+
|
33
|
+
|
28
34
|
|
29
35
|
with open(path) as f:
|
30
36
|
|
2
誤表記の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,9 +24,11 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
+
```python
|
28
|
+
|
27
29
|
with open(path) as f:
|
28
30
|
|
29
|
-
|
31
|
+
data = f.read()
|
30
32
|
|
31
33
|
|
32
34
|
|
@@ -63,3 +65,5 @@
|
|
63
65
|
noun = np.append(noun, np.array(noun), axis=0)
|
64
66
|
|
65
67
|
print(noun)
|
68
|
+
|
69
|
+
```
|
1
作成中のプログラムです。
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,4 +24,42 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
|
27
|
+
with open(path) as f:
|
28
|
+
|
29
|
+
data = f.read()
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
mecab = MeCab.Tagger()
|
34
|
+
|
35
|
+
parse = mecab.parse(data)
|
36
|
+
|
37
|
+
lines = parse.split('\n')
|
38
|
+
|
39
|
+
items = (re.split('[\t,]', line) for line in lines)
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
words = [item[0]
|
44
|
+
|
45
|
+
for item in items
|
46
|
+
|
47
|
+
if (item[0] not in ('EOS', '', 't', 'ー') and
|
48
|
+
|
49
|
+
item[1] == '名詞' and item[2] == '一般')]
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
noun = np.array([])
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
for word in words:
|
58
|
+
|
59
|
+
noun = np.append(noun, word)
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
noun = np.append(noun, np.array(noun), axis=0)
|
64
|
+
|
65
|
+
print(noun)
|