Kosuke-Yamada commited on
Commit
977bce8
1 Parent(s): 95b9fdc

specify encoding method when loading dataset

Browse files
Files changed (1) hide show
  1. ner-wikinews-dataset.py +4 -13
ner-wikinews-dataset.py CHANGED
@@ -1,18 +1,9 @@
1
  import json
2
  from typing import Generator
3
 
4
- from datasets import (
5
- BuilderConfig,
6
- DatasetInfo,
7
- DownloadManager,
8
- Features,
9
- GeneratorBasedBuilder,
10
- Sequence,
11
- Split,
12
- SplitGenerator,
13
- Value,
14
- Version,
15
- )
16
 
17
  _CITATION = ""
18
  _DESCRIPTION = "This is a dataset of Wikinews articles manually labeled with the named entity label."
@@ -86,7 +77,7 @@ class NerWikinewsDataset(GeneratorBasedBuilder):
86
  self, dl_manager: DownloadManager
87
  ) -> list[SplitGenerator]:
88
  data_file = dl_manager.download_and_extract(_URL)
89
- with open(data_file, "r") as f:
90
  data = json.load(f)
91
  data = self._convert_data_format(data)
92
  return [
 
1
  import json
2
  from typing import Generator
3
 
4
+ from datasets import (BuilderConfig, DatasetInfo, DownloadManager, Features,
5
+ GeneratorBasedBuilder, Sequence, Split, SplitGenerator,
6
+ Value, Version)
 
 
 
 
 
 
 
 
 
7
 
8
  _CITATION = ""
9
  _DESCRIPTION = "This is a dataset of Wikinews articles manually labeled with the named entity label."
 
77
  self, dl_manager: DownloadManager
78
  ) -> list[SplitGenerator]:
79
  data_file = dl_manager.download_and_extract(_URL)
80
+ with open(data_file, "r", encoding="utf-8") as f:
81
  data = json.load(f)
82
  data = self._convert_data_format(data)
83
  return [