質問編集履歴
1
Exsample→example。エラーも無事解決しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
```python
|
9
9
|
import os
|
10
10
|
import MeCab
|
11
|
-
from torchtext.data import Dataset, Field, Ex
|
11
|
+
from torchtext.data import Dataset, Field, Example
|
12
12
|
from torchtext.vocab import Vectors
|
13
13
|
|
14
14
|
tagger = MeCab.Tagger()
|
@@ -48,7 +48,7 @@
|
|
48
48
|
# 1-2行目はURLと日付のため3行目以降を用いる
|
49
49
|
text = '\n'.join(f.read().splitlines()[2:])
|
50
50
|
# アイテム(torchtextのExsampleインスタンス)を作成
|
51
|
-
exsample = Ex
|
51
|
+
exsample = Example.fromlist([text, label], fields)
|
52
52
|
exsamples.append(exsample)
|
53
53
|
|
54
54
|
#アイテムのリストとフィールドの定義を用いてDatasetインスタンスを作成
|