質問編集履歴
4
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -14,24 +14,25 @@
|
|
14
14
|
```python
|
15
15
|
import mecab
|
16
16
|
import re
|
17
|
+
import numpy as np
|
17
18
|
|
18
19
|
with open(path) as f:
|
19
|
-
|
20
|
+
data = f.read()
|
20
21
|
|
21
|
-
|
22
|
+
mecab = MeCab.Tagger()
|
22
|
-
|
23
|
+
parse = mecab.parse(data)
|
23
|
-
|
24
|
+
lines = parse.split('\n')
|
24
|
-
|
25
|
+
items = (re.split('[\t,]', line) for line in lines)
|
25
26
|
|
26
|
-
|
27
|
+
words = [item[0]
|
27
|
-
|
28
|
+
for item in items
|
28
|
-
|
29
|
+
if (item[0] not in ('EOS', '', 't', 'ー') and
|
29
|
-
|
30
|
+
item[1] == '名詞' and item[2] == '一般')]
|
30
31
|
|
31
32
|
noun = np.array([])
|
32
33
|
|
33
34
|
for word in words:
|
34
|
-
|
35
|
+
noun = np.append(noun, word)
|
35
36
|
|
36
37
|
noun = np.append(noun, np.array(noun), axis=0)
|
37
38
|
print(noun)
|
3
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,6 +12,9 @@
|
|
12
12
|
### 補足情報(FW/ツールのバージョンなど)
|
13
13
|
|
14
14
|
```python
|
15
|
+
import mecab
|
16
|
+
import re
|
17
|
+
|
15
18
|
with open(path) as f:
|
16
19
|
data = f.read()
|
17
20
|
|
2
誤表記の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -11,8 +11,9 @@
|
|
11
11
|
|
12
12
|
### 補足情報(FW/ツールのバージョンなど)
|
13
13
|
|
14
|
+
```python
|
14
15
|
with open(path) as f:
|
15
|
-
|
16
|
+
data = f.read()
|
16
17
|
|
17
18
|
mecab = MeCab.Tagger()
|
18
19
|
parse = mecab.parse(data)
|
@@ -30,4 +31,5 @@
|
|
30
31
|
noun = np.append(noun, word)
|
31
32
|
|
32
33
|
noun = np.append(noun, np.array(noun), axis=0)
|
33
|
-
print(noun)
|
34
|
+
print(noun)
|
35
|
+
```
|
1
作成中のプログラムです。
title
CHANGED
File without changes
|
body
CHANGED
@@ -11,4 +11,23 @@
|
|
11
11
|
|
12
12
|
### 補足情報(FW/ツールのバージョンなど)
|
13
13
|
|
14
|
-
|
14
|
+
with open(path) as f:
|
15
|
+
data = f.read()
|
16
|
+
|
17
|
+
mecab = MeCab.Tagger()
|
18
|
+
parse = mecab.parse(data)
|
19
|
+
lines = parse.split('\n')
|
20
|
+
items = (re.split('[\t,]', line) for line in lines)
|
21
|
+
|
22
|
+
words = [item[0]
|
23
|
+
for item in items
|
24
|
+
if (item[0] not in ('EOS', '', 't', 'ー') and
|
25
|
+
item[1] == '名詞' and item[2] == '一般')]
|
26
|
+
|
27
|
+
noun = np.array([])
|
28
|
+
|
29
|
+
for word in words:
|
30
|
+
noun = np.append(noun, word)
|
31
|
+
|
32
|
+
noun = np.append(noun, np.array(noun), axis=0)
|
33
|
+
print(noun)
|