Upload bookcoref.py with huggingface_hub
Browse files- bookcoref.py +3 -6
bookcoref.py
CHANGED
@@ -100,7 +100,7 @@ class BookCoref(datasets.GeneratorBasedBuilder):
|
|
100 |
self.logger = self._setup_logger()
|
101 |
self.logger.info("Initializing BOOKCOREF dataset.")
|
102 |
# Download nltk if not already downloaded
|
103 |
-
nltk.download("
|
104 |
# Download and load spaCy model for tokenization if not already downloaded
|
105 |
try:
|
106 |
self.nlp = spacy.load("en_core_web_sm")
|
@@ -158,7 +158,7 @@ class BookCoref(datasets.GeneratorBasedBuilder):
|
|
158 |
# Create console handler with a specific format
|
159 |
handler = logging.StreamHandler(sys.stdout)
|
160 |
formatter = logging.Formatter(
|
161 |
-
"[%(asctime)s][bookcoref
|
162 |
)
|
163 |
handler.setFormatter(formatter)
|
164 |
|
@@ -317,10 +317,7 @@ class BookCoref(datasets.GeneratorBasedBuilder):
|
|
317 |
# Apply delta
|
318 |
self.logger.info("Applying delta...")
|
319 |
flattened_complete_sentences = flattened_downloaded_sentences + delta
|
320 |
-
|
321 |
-
self.logger.info(
|
322 |
-
f"Applied delta to downloaded sentences, resulting in {len(flattened_complete_sentences)} sentences."
|
323 |
-
)
|
324 |
|
325 |
# Reconvert back to sentences
|
326 |
complete_sentences = defaultdict(list)
|
|
|
100 |
self.logger = self._setup_logger()
|
101 |
self.logger.info("Initializing BOOKCOREF dataset.")
|
102 |
# Download nltk if not already downloaded
|
103 |
+
nltk.download("punkt", quiet=True)
|
104 |
# Download and load spaCy model for tokenization if not already downloaded
|
105 |
try:
|
106 |
self.nlp = spacy.load("en_core_web_sm")
|
|
|
158 |
# Create console handler with a specific format
|
159 |
handler = logging.StreamHandler(sys.stdout)
|
160 |
formatter = logging.Formatter(
|
161 |
+
"[%(asctime)s][bookcoref][%(levelname)s] %(message)s", datefmt="%Y-%m-%d %H:%M:%S"
|
162 |
)
|
163 |
handler.setFormatter(formatter)
|
164 |
|
|
|
317 |
# Apply delta
|
318 |
self.logger.info("Applying delta...")
|
319 |
flattened_complete_sentences = flattened_downloaded_sentences + delta
|
320 |
+
self.logger.info("Applied delta to downloaded sentences.")
|
|
|
|
|
|
|
321 |
|
322 |
# Reconvert back to sentences
|
323 |
complete_sentences = defaultdict(list)
|