質問編集履歴
2
質問タイトルの変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Python MeCabの
|
1
|
+
Python MeCabのTaggerの引数をchasenにすると実行できない
|
body
CHANGED
File without changes
|
1
書式の改善
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,11 +1,78 @@
|
|
1
|
+
### 前提
|
2
|
+
WindowsにてVisual Studio CodeでPython 3.9.4を使用しています。
|
3
|
+
MeCabを使ってみようと思い、基礎的な使い方を確かめるため、Web上の入門的なサイトを見ながら
|
4
|
+
コードを真似ながら書いています。Taggerの引数を順番に変えながら出力結果を見ようとしています。
|
5
|
+
mecab-python3、unidic-liteをpipでインストールしました。
|
1
6
|
|
7
|
+
### 実現したいこと
|
8
|
+
文章をChasenの出力フォーマットで表示
|
9
|
+
|
10
|
+
### エラーメッセージ
|
11
|
+
どこが主たるエラーメッセージかわからなかったため全体を載せます。見にくかったらすみません。
|
12
|
+
```
|
13
|
+
例外が発生しました: RuntimeError
|
14
|
+
|
15
|
+
----------------------------------------------------------
|
16
|
+
|
17
|
+
Failed initializing MeCab. Please see the README for possible solutions:
|
18
|
+
|
19
|
+
https://github.com/SamuraiT/mecab-python3#common-issues
|
20
|
+
|
21
|
+
If you are still having trouble, please file an issue here, and include the
|
22
|
+
ERROR DETAILS below:
|
23
|
+
|
24
|
+
https://github.com/SamuraiT/mecab-python3/issues
|
25
|
+
|
26
|
+
issueを英語で書く必要はありません。
|
27
|
+
|
28
|
+
------------------- ERROR DETAILS ------------------------
|
29
|
+
arguments: -Ochasen
|
30
|
+
default dictionary path: c:\Users\ユーザネーム\AppData\Local\Programs\Python\Python39\lib\site-packages\unidic_lite\dicdir
|
31
|
+
[!tmp.empty()] unknown format type [chasen]
|
32
|
+
----------------------------------------------------------
|
2
|
-
|
33
|
+
RuntimeError:
|
34
|
+
|
35
|
+
The above exception was the direct cause of the following exception:
|
36
|
+
|
37
|
+
File "C:\Users\ユーザーネーム\sample1\ファイル名.py", line 10, in <module>
|
3
|
-
MeCab.Tagger
|
38
|
+
tagger = MeCab.Tagger("-Ochasen")
|
39
|
+
RuntimeError:
|
4
|
-
|
40
|
+
----------------------------------------------------------
|
41
|
+
|
42
|
+
Failed initializing MeCab. Please see the README for possible solutions:
|
43
|
+
|
44
|
+
https://github.com/SamuraiT/mecab-python3#common-issues
|
45
|
+
|
46
|
+
If you are still having trouble, please file an issue here, and include the
|
47
|
+
ERROR DETAILS below:
|
48
|
+
|
49
|
+
https://github.com/SamuraiT/mecab-python3/issues
|
50
|
+
|
51
|
+
issueを英語で書く必要はありません。
|
52
|
+
|
53
|
+
------------------- ERROR DETAILS ------------------------
|
54
|
+
arguments: -Ochasen
|
55
|
+
default dictionary path: c:\Users\ユーザーネーム\AppData\Local\Programs\Python\Python39\lib\site-packages\unidic_lite\dicdir
|
56
|
+
[!tmp.empty()] unknown format type [chasen]
|
57
|
+
----------------------------------------------------------
|
58
|
+
```
|
59
|
+
|
60
|
+
### ソースコード
|
61
|
+
```Python
|
62
|
+
import MeCab
|
63
|
+
|
64
|
+
tagger = MeCab.Tagger("-Ochasen")
|
65
|
+
result = tagger.parse("Pythonはオープンソースのプログラミング言語であり、人工知能や機械学習などの分野で広く使われています。")
|
66
|
+
print(result)
|
67
|
+
```
|
68
|
+
|
69
|
+
### 調べたこと、試したこと
|
70
|
+
- Taggerの引数を-Owakatiや-Odumpにするときちんと出力されます。
|
71
|
+
- 以下のサイトにある方法であればきちんと出力された
|
72
|
+
[WindowsにおけるMeCab使用時のErrorについて](https://github.com/SamuraiT/mecab-python3/issues/54)
|
5
|
-
回答にある辞書が置いてあるディレクトリというのが
|
73
|
+
- さらに調べていくうち、以下の質問が似ていると思い回答を見ましたたが、回答にある”辞書が置いてあるディレクトリ”というのがどこにあるかわからず、解決できませんでした。
|
6
|
-
通常どこに生成されるのでしょうか
|
7
74
|
[pythonでMeCabを使おうとするとエラー](https://teratail.com/questions/292541)
|
8
75
|
|
9
|
-
|
10
|
-
### 補足情報(FW/ツールのバージョンなど)
|
11
|
-
|
76
|
+
### 個人的な興味、疑問
|
77
|
+
[pythonでMeCabを使おうとするとエラー](https://teratail.com/questions/292541)
|
78
|
+
この回答にあるdicrcというファイルは本来どうすれば生成されるものなのでしょうか。
|