Datasets:
Tasks:
Token Classification
Sub-tasks:
named-entity-recognition
Languages:
English
Size:
1K<n<10K
License:
Update indian_names.py
Browse files55 unmodified lines565758596061621 unmodified line646566676869707172737475766 unmodified lines83848586878855 unmodified linesdatasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),]def _generate_examples(self, filepath):with open(filepath, encoding="utf-8") as f:current_tokens = []current_labels = []1 unmodified linefor row in f:row = row.rstrip()if row:token, label = row.split(",")current_tokens.append(token)current_labels.append(label)else:if not current_tokens:continueassert len(current_tokens) == len(current_labels), "Mismatch between tokens and labels"sentence = (sentence_counter,{6 unmodified linescurrent_tokens = []current_labels = []yield sentenceif current_tokens:yield sentence_counter, {"id": str(sentence_counter),55 unmodified lines56575859606162631 unmodified line6566676869707172737475767778796 unmodified lines8687888990919255 unmodified linesdatasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files["train"]}),]def _generate_examples(self, filepath):logger.info("⏳ Generating examples from = %s", filepath)with open(filepath, encoding="utf-8") as f:current_tokens = []current_labels = []1 unmodified linefor row in f:row = row.rstrip()if row:token, label = row.split("\t")current_tokens.append(token)current_labels.append(label)else:# New sentenceif not current_tokens:# Consecutive empty lines will cause empty sentencescontinueassert len(current_tokens) == len(current_labels), "💔 between len of tokens & labels"sentence = (sentence_counter,{6 unmodified linescurrent_tokens = []current_labels = []yield sentence# Don't forget last sentence in dataset 🧐if current_tokens:yield sentence_counter, {"id": str(sentence_counter),
indian_names.py+7-3