Matej Klemen commited on
Commit ·
b2bdc31
1
Parent(s): d7406d5
Multiple fixes:
Browse files* Fix indices inside corrections pointing to out-of-bounds tokens due to some sentences not being marked in the 'corresp' field of the correction group tag
* Write the correct version of the dataset (3.0 instead of 1.0)
* Correct the statistic of manually annotated documents
* Remove idx_par, idx_sent for source and target sentences
Files changed (3)
- README.md+5-11
- dataset_infos.json+1-1
- solar3.py+55-31
33 unmodified lines3435363738394047 unmodified lines888990919293949596979813 unmodified lines1121131141151161171181191201211221231245 unmodified lines13013113213313413513633 unmodified linesŠolar* is a developmental corpus of 5485 school texts (e.g., essays), written by students in Slovenian secondary schools(age 15-19) and pupils in the 7th-9th grade of primary school (13-15), with a small percentage also from the 6th grade.Part of the corpus (2094 texts) is annotated with teachers' corrections using a system of labels described in thedocument available at https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1589/Smernice-za-oznacevanje-korpusa-Solar_V1.1.pdf (in Slovenian).\(*) pronounce "š" as "sh" in "shoe".47 unmodified lines{'id_doc': 'solar1','doc_title': 'KUS-G-slo-1-GO-E-2009-10001','is_manually_validated': True,'idx_src_par': 2, 'idx_src_sent': 0,'id_src_tokens': ['solar1s.3.1.1', 'solar1s.3.1.2', 'solar1s.3.1.3', 'solar1s.3.1.4', 'solar1s.3.1.5', 'solar1s.3.1.6', 'solar1s.3.1.7', 'solar1s.3.1.8', 'solar1s.3.1.9', 'solar1s.3.1.10', 'solar1s.3.1.11', 'solar1s.3.1.12', 'solar1s.3.1.13', 'solar1s.3.1.14', 'solar1s.3.1.15', 'solar1s.3.1.16', 'solar1s.3.1.17', 'solar1s.3.1.18', 'solar1s.3.1.19', 'solar1s.3.1.20', 'solar1s.3.1.21', 'solar1s.3.1.22', 'solar1s.3.1.23', 'solar1s.3.1.24', 'solar1s.3.1.25'],'src_tokens': ['”', 'Ne', 'da', 'sovražim', ',', 'da', 'ljubim', 'sem', 'na', 'svetu', '”', ',', 'izreče', 'Antigona', 'v', 'bran', 'kralju', 'Kreonu', 'za', 'svoje', 'nasprotno', 'mišljenje', 'pred', 'smrtjo', '.'],'idx_tgt_par': 2, 'idx_tgt_sent': 0,'id_tgt_tokens': ['solar1t.3.1.1', 'solar1t.3.1.2', 'solar1t.3.1.3', 'solar1t.3.1.4', 'solar1t.3.1.5', 'solar1t.3.1.6', 'solar1t.3.1.7', 'solar1t.3.1.8', 'solar1t.3.1.9', 'solar1t.3.1.10', 'solar1t.3.1.11', 'solar1t.3.1.12', 'solar1t.3.1.13', 'solar1t.3.1.14', 'solar1t.3.1.15', 'solar1t.3.1.16', 'solar1t.3.1.17', 'solar1t.3.1.18', 'solar1t.3.1.19', 'solar1t.3.1.20', 'solar1t.3.1.21', 'solar1t.3.1.22', 'solar1t.3.1.23', 'solar1t.3.1.24', 'solar1t.3.1.25', 'solar1t.3.1.26'],'tgt_tokens': ['„', 'Ne', 'da', 'sovražim', ',', 'da', 'ljubim', 'sem', 'na', 'svetu', ',', '”', 'izreče', 'Antigona', 'sebi', 'v', 'bran', 'kralju', 'Kreonu', 'za', 'svoje', 'nasprotno', 'mišljenje', 'pred', 'smrtjo', '.'],'corrections': [13 unmodified lines- `id_doc`: a string containing the identifying name of the document in which the sentence appears;- `doc_title`: a string containing the assigned document title;- `is_manually_validated`: a bool indicating whether the document in which the sentence appears was reviewed by a teacher;- `idx_src_par`: a uint32 containing the index of the paragraph in which the source sentence appears (`-1` if there is no source sentence);- `idx_src_sent`: a uint32 containing the index of the source sentence inside its paragraph (`-1` if there is no source sentence);- `id_src_tokens`: identifiers of words in the source sentence (`[]` if there is no source sentence);- `src_tokens`: words in the source sentence (`[]` if there is no source sentence);- `idx_tgt_par`: a uint32 containing the index of the paragraph in which the target sentence appears (`-1` if there is no target sentence);- `idx_tgt_sent`: a uint32 containing the index of the target sentence inside its paragraph (`-1` if there is no target sentence);- `id_tgt_tokens`: identifiers of words in the target sentence (`[]` if there is no target sentence);- `tgt_tokens`: words in the target sentence (`[]` if there is no target sentence);- `corrections`: a list of the corrections, with each correction represented with a dictionary, containing the indices of the source tokens involved (`idx_src`), target tokens involved (`idx_tgt`), and the categories of the corrections made (`corr_types`). Please note that there can be multiple assigned categories for one annotated correction, in which case `len(corr_types) > 1`.5 unmodified linesThe Developmental corpus Šolar consists of 5,485 texts written by students in Slovenian secondary schools (age 15-19) and pupils in the 7th-9th grade of primary school (13-15), with a small percentage also from the 6th grade. The information on school (elementary or secondary), subject, level (grade or year), type of text, region, and date of production is provided for each text. School essays form the majority of the corpus while other material includes texts created during lessons, such as text recapitulations or descriptions, examples of formal applications, etc.Part of the corpus (2,094 texts) is annotated with teachers' corrections using a system of labels described in the attached document (in Slovenian). Teacher corrections were part of the original files and reflect real classroom situations of essay marking. Corrections were then inserted into texts by annotators and subsequently categorized.## Additional Information33 unmodified lines3435363738394047 unmodified lines88899091929394959613 unmodified lines1101111121131141151161171185 unmodified lines12412512612712812913033 unmodified linesŠolar* is a developmental corpus of 5485 school texts (e.g., essays), written by students in Slovenian secondary schools(age 15-19) and pupils in the 7th-9th grade of primary school (13-15), with a small percentage also from the 6th grade.Part of the corpus (1516 texts) is annotated with teachers' corrections using a system of labels described in thedocument available at https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1589/Smernice-za-oznacevanje-korpusa-Solar_V1.1.pdf (in Slovenian).\(*) pronounce "š" as "sh" in "shoe".47 unmodified lines{'id_doc': 'solar1','doc_title': 'KUS-G-slo-1-GO-E-2009-10001','is_manually_validated': True,'id_src_tokens': ['solar1s.3.1.1', 'solar1s.3.1.2', 'solar1s.3.1.3', 'solar1s.3.1.4', 'solar1s.3.1.5', 'solar1s.3.1.6', 'solar1s.3.1.7', 'solar1s.3.1.8', 'solar1s.3.1.9', 'solar1s.3.1.10', 'solar1s.3.1.11', 'solar1s.3.1.12', 'solar1s.3.1.13', 'solar1s.3.1.14', 'solar1s.3.1.15', 'solar1s.3.1.16', 'solar1s.3.1.17', 'solar1s.3.1.18', 'solar1s.3.1.19', 'solar1s.3.1.20', 'solar1s.3.1.21', 'solar1s.3.1.22', 'solar1s.3.1.23', 'solar1s.3.1.24', 'solar1s.3.1.25'],'src_tokens': ['”', 'Ne', 'da', 'sovražim', ',', 'da', 'ljubim', 'sem', 'na', 'svetu', '”', ',', 'izreče', 'Antigona', 'v', 'bran', 'kralju', 'Kreonu', 'za', 'svoje', 'nasprotno', 'mišljenje', 'pred', 'smrtjo', '.'],'id_tgt_tokens': ['solar1t.3.1.1', 'solar1t.3.1.2', 'solar1t.3.1.3', 'solar1t.3.1.4', 'solar1t.3.1.5', 'solar1t.3.1.6', 'solar1t.3.1.7', 'solar1t.3.1.8', 'solar1t.3.1.9', 'solar1t.3.1.10', 'solar1t.3.1.11', 'solar1t.3.1.12', 'solar1t.3.1.13', 'solar1t.3.1.14', 'solar1t.3.1.15', 'solar1t.3.1.16', 'solar1t.3.1.17', 'solar1t.3.1.18', 'solar1t.3.1.19', 'solar1t.3.1.20', 'solar1t.3.1.21', 'solar1t.3.1.22', 'solar1t.3.1.23', 'solar1t.3.1.24', 'solar1t.3.1.25', 'solar1t.3.1.26'],'tgt_tokens': ['„', 'Ne', 'da', 'sovražim', ',', 'da', 'ljubim', 'sem', 'na', 'svetu', ',', '”', 'izreče', 'Antigona', 'sebi', 'v', 'bran', 'kralju', 'Kreonu', 'za', 'svoje', 'nasprotno', 'mišljenje', 'pred', 'smrtjo', '.'],'corrections': [13 unmodified lines- `id_doc`: a string containing the identifying name of the document in which the sentence appears;- `doc_title`: a string containing the assigned document title;- `is_manually_validated`: a bool indicating whether the document in which the sentence appears was reviewed by a teacher;- `id_src_tokens`: identifiers of words in the source sentence (`[]` if there is no source sentence);- `src_tokens`: words in the source sentence (`[]` if there is no source sentence);- `id_tgt_tokens`: identifiers of words in the target sentence (`[]` if there is no target sentence);- `tgt_tokens`: words in the target sentence (`[]` if there is no target sentence);- `corrections`: a list of the corrections, with each correction represented with a dictionary, containing the indices of the source tokens involved (`idx_src`), target tokens involved (`idx_tgt`), and the categories of the corrections made (`corr_types`). Please note that there can be multiple assigned categories for one annotated correction, in which case `len(corr_types) > 1`.5 unmodified linesThe Developmental corpus Šolar consists of 5,485 texts written by students in Slovenian secondary schools (age 15-19) and pupils in the 7th-9th grade of primary school (13-15), with a small percentage also from the 6th grade. The information on school (elementary or secondary), subject, level (grade or year), type of text, region, and date of production is provided for each text. School essays form the majority of the corpus while other material includes texts created during lessons, such as text recapitulations or descriptions, examples of formal applications, etc.Part of the corpus (1516 texts) is annotated with teachers' corrections using a system of labels described in the attached document (in Slovenian). Teacher corrections were part of the original files and reflect real classroom situations of essay marking. Corrections were then inserted into texts by annotators and subsequently categorized.## Additional Information
1{"default": {"description": "\u0160olar is a developmental corpus of 5485 school texts (e.g., essays), written by students in Slovenian secondary schools \n(age 15-19) and pupils in the 7th-9th grade of primary school (13-15), with a small percentage also from the 6th grade. \nPart of the corpus (2,094 texts) is annotated with teachers' corrections using a system of labels described in the \ndocument available at https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1589/Smernice-za-oznacevanje-korpusa-Solar_V1.1.pdf (in Slovenian).\n", "citation": "@misc{solar3.0,\n title = {Developmental corpus {\u000b S}olar 3.0},\n author = {Arhar Holdt, {\u000b S}pela and Rozman, Tadeja and Stritar Ku{\u000b c}uk, Mojca and Krek, Simon and Krap{\u000b s} Vodopivec, Irena and Stabej, Marko and Pori, Eva and Goli, Teja and Lavri{\u000b c}, Polona and Laskowski, Cyprian and Kocjan{\u000b c}i{\u000b c}, Polonca and Klemenc, Bojan and Krsnik, Luka and Kosem, Iztok},\n url = {http://hdl.handle.net/11356/1589},\n note = {Slovenian language resource repository {CLARIN}.{SI}},\n year = {2022}\n}\n", "homepage": "http://hdl.handle.net/11356/1589", "license": "Creative Commons - Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", "features": {"id_doc": {"dtype": "string", "id": null, "_type": "Value"}, "doc_title": {"dtype": "string", "id": null, "_type": "Value"}, "is_manually_validated": {"dtype": "bool", "id": null, "_type": "Value"}, "idx_src_par": {"dtype": "int32", "id": null, "_type": "Value"}, "idx_src_sent": {"dtype": "int32", "id": null, "_type": "Value"}, "id_src_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "src_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "idx_tgt_par": {"dtype": "int32", "id": null, "_type": "Value"}, "idx_tgt_sent": {"dtype": "int32", "id": null, "_type": "Value"}, "id_tgt_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "tgt_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "corrections": [{"idx_src": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "idx_tgt": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "corr_types": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}]}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "solar3", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 122284807, "num_examples": 125867, "dataset_name": "solar3"}}, "download_checksums": {"https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1589/Solar.TEI.zip": {"num_bytes": 99287852, "checksum": "188945c90c663cc34c77c6aefd40357b60b88436b3d9fd53f24304c927ac1cbf"}}, "download_size": 99287852, "post_processing_size": null, "dataset_size": 122284807, "size_in_bytes": 221572659}}1{"default": {"description": "\u0160olar is a developmental corpus of 5485 school texts (e.g., essays), written by students in Slovenian secondary schools \n(age 15-19) and pupils in the 7th-9th grade of primary school (13-15), with a small percentage also from the 6th grade. \nPart of the corpus (2,094 texts) is annotated with teachers' corrections using a system of labels described in the \ndocument available at https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1589/Smernice-za-oznacevanje-korpusa-Solar_V1.1.pdf (in Slovenian).\n", "citation": "@misc{solar3.0,\n title = {Developmental corpus {\u000b S}olar 3.0},\n author = {Arhar Holdt, {\u000b S}pela and Rozman, Tadeja and Stritar Ku{\u000b c}uk, Mojca and Krek, Simon and Krap{\u000b s} Vodopivec, Irena and Stabej, Marko and Pori, Eva and Goli, Teja and Lavri{\u000b c}, Polona and Laskowski, Cyprian and Kocjan{\u000b c}i{\u000b c}, Polonca and Klemenc, Bojan and Krsnik, Luka and Kosem, Iztok},\n url = {http://hdl.handle.net/11356/1589},\n note = {Slovenian language resource repository {CLARIN}.{SI}},\n year = {2022}\n}\n", "homepage": "http://hdl.handle.net/11356/1589", "license": "Creative Commons - Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)", "features": {"id_doc": {"dtype": "string", "id": null, "_type": "Value"}, "doc_title": {"dtype": "string", "id": null, "_type": "Value"}, "is_manually_validated": {"dtype": "bool", "id": null, "_type": "Value"}, "id_src_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "src_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "id_tgt_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "tgt_tokens": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "corrections": [{"idx_src": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "idx_tgt": {"feature": {"dtype": "int32", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}, "corr_types": {"feature": {"dtype": "string", "id": null, "_type": "Value"}, "length": -1, "id": null, "_type": "Sequence"}}]}, "post_processed": null, "supervised_keys": null, "task_templates": null, "builder_name": "solar3", "config_name": "default", "version": {"version_str": "1.0.0", "description": null, "major": 1, "minor": 0, "patch": 0}, "splits": {"train": {"name": "train", "num_bytes": 120154479, "num_examples": 125867, "dataset_name": "solar3"}}, "download_checksums": {"https://www.clarin.si/repository/xmlui/bitstream/handle/11356/1589/Solar.TEI.zip": {"num_bytes": 99287852, "checksum": "188945c90c663cc34c77c6aefd40357b60b88436b3d9fd53f24304c927ac1cbf"}}, "download_size": 99287852, "post_processing_size": null, "dataset_size": 120154479, "size_in_bytes": 219442331}}
62 unmodified lines63646566676829 unmodified lines98991001011021031041055 unmodified lines1111121131141151161171 unmodified line11912012112212312412512612712812913040 unmodified lines17117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320410 unmodified lines2152162172182192202215 unmodified lines22722822923023123223323423523623723862 unmodified linesreturn annsdef read_data(data_path):data = {} # ID_sent -> sentence_metadatatree = ET.parse(data_path)29 unmodified linesdata[id_sent] = {"id_doc": id_text,"doc_title": text_title,"idx_par": idx_par,"idx_sent": idx_sent,"id_token": ids, "form": forms, "lemma": lemmas, "msd": msds, "ne_tag": nes,"is_manually_validated": is_manually_validated}5 unmodified lines"""Šolar is a developmental corpus of school texts (e.g., essays), annotated with metadata and (partially)with teachers' corrections. """VERSION = datasets.Version("1.0.0")def _info(self):features = datasets.Features(1 unmodified line"id_doc": datasets.Value("string"),"doc_title": datasets.Value("string"),"is_manually_validated": datasets.Value("bool"),"idx_src_par": datasets.Value("int32"),"idx_src_sent": datasets.Value("int32"),"id_src_tokens": datasets.Sequence(datasets.Value("string")),"src_tokens": datasets.Sequence(datasets.Value("string")),"idx_tgt_par": datasets.Value("int32"),"idx_tgt_sent": datasets.Value("int32"),"id_tgt_tokens": datasets.Sequence(datasets.Value("string")),"tgt_tokens": datasets.Sequence(datasets.Value("string")),"corrections": [40 unmodified linesfor idx_corr, corrected_sent in enumerate(root.iterfind(f"{NAMESPACE}linkGrp")):involved_sents = corrected_sent.attrib["corresp"].split(" ")assert len(involved_sents) <= 2, f"The following correction has more than two sentences involved, " \f"which the script cannot handle: {corrected_sent.attrib}"if len(involved_sents) == 2:# not always ordered <source> <target>, sometimes reversedif "t" in involved_sents[0]:id_src_sent, id_tgt_sent = list(map(lambda _s: _s[1:], involved_sents[::-1]))else:id_src_sent, id_tgt_sent = list(map(lambda _s: _s[1:], involved_sents))else: # one sentence: only source or only target (usually a sentence marked as redundant or as missing)id_src_sent, id_tgt_sent = None, Noneif "t" in involved_sents[0]:id_tgt_sent = involved_sents[0][1:]else:id_src_sent = involved_sents[0][1:]id_doc, doc_title, is_manually_validated = None, None, Falsesrc_sent_data, tgt_sent_data = {}, {}assert id_src_sent is not None or id_tgt_sent is not Noneif id_src_sent is not None:src_sent_data = source_data[id_src_sent]id_doc = src_sent_data["id_doc"]doc_title = src_sent_data["doc_title"]is_manually_validated |= src_sent_data["is_manually_validated"]if id_tgt_sent is not None:tgt_sent_data = target_data[id_tgt_sent]id_doc = tgt_sent_data["id_doc"]doc_title = tgt_sent_data["doc_title"]is_manually_validated |= tgt_sent_data["is_manually_validated"]corr_data = []for token_info in corrected_sent.findall(f"{NAMESPACE}link"):10 unmodified linesfor curr_tok in connections:# Token IDs have an index at the end, but it is 1-based; convert it to 0-basedidx_tok = int(curr_tok.split(".")[-1]) - 1if "t" in curr_tok: # target tokentgt_inds.append(idx_tok)else: # source token5 unmodified lines"id_doc": id_doc[:-1], # doc ID without the "s" or "t" info"doc_title": doc_title,"is_manually_validated": is_manually_validated,"idx_src_par": src_sent_data.get("idx_par", -1),"idx_src_sent": src_sent_data.get("idx_sent", -1),"id_src_tokens": src_sent_data.get("id_token", []),"src_tokens": src_sent_data.get("form", []),"idx_tgt_par": tgt_sent_data.get("idx_par", -1),"idx_tgt_sent": tgt_sent_data.get("idx_sent", -1),"id_tgt_tokens": tgt_sent_data.get("id_token", []),"tgt_tokens": tgt_sent_data.get("form", []),"corrections": corr_data62 unmodified lines6364656667686970717273747576777879808182838485868788899029 unmodified lines1201211221231241255 unmodified lines1311321331341351361371 unmodified line13914014114214314414514640 unmodified lines18718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123210 unmodified lines2432442452462472482495 unmodified lines25525625725825926026126262 unmodified linesreturn annsdef extract_sent_id(tok_id):# e.g., `extract_sent_id("#solar1s.3.2.44") == "solar1s.3.2"` or `extract_sent_id("solar1s.3.2.44") == "solar1s.3.2"`_tok_id = tok_id[1:] if tok_id.startswith("#") else tok_idreturn ".".join(_tok_id.split(".")[: -1])def find_involved_sents(correction_group_el):src_sent_ids = set()tgt_sent_ids = set()for _curr_corr in correction_group_el:sent_ids = list(map(lambda _tok_id: extract_sent_id(_tok_id),_curr_corr.attrib["target"].split(" ")))for _s_id in sent_ids:if "t" in _s_id:tgt_sent_ids.add(_s_id)else:src_sent_ids.add(_s_id)return sorted(list(src_sent_ids)), sorted(list(tgt_sent_ids))def read_data(data_path):data = {} # ID_sent -> sentence_metadatatree = ET.parse(data_path)29 unmodified linesdata[id_sent] = {"id_doc": id_text,"doc_title": text_title,"id_token": ids, "form": forms, "lemma": lemmas, "msd": msds, "ne_tag": nes,"is_manually_validated": is_manually_validated}5 unmodified lines"""Šolar is a developmental corpus of school texts (e.g., essays), annotated with metadata and (partially)with teachers' corrections. """VERSION = datasets.Version("3.0.0")def _info(self):features = datasets.Features(1 unmodified line"id_doc": datasets.Value("string"),"doc_title": datasets.Value("string"),"is_manually_validated": datasets.Value("bool"),"id_src_tokens": datasets.Sequence(datasets.Value("string")),"src_tokens": datasets.Sequence(datasets.Value("string")),"id_tgt_tokens": datasets.Sequence(datasets.Value("string")),"tgt_tokens": datasets.Sequence(datasets.Value("string")),"corrections": [40 unmodified linesfor idx_corr, corrected_sent in enumerate(root.iterfind(f"{NAMESPACE}linkGrp")):involved_sents = corrected_sent.attrib["corresp"].split(" ")# Involved sentences according to the IDs of token mappings - 'corresp' does not list all of them!# (possible bug in data)involved_src_sents, involved_tgt_sents = find_involved_sents(corrected_sent)id_doc, doc_title, is_manually_validated = None, None, Falsesrc_sent_data, tgt_sent_data = {}, {}tok2position = {}assert len(involved_src_sents) > 0 or len(involved_tgt_sents) > 0if len(involved_src_sents) > 0:src_sent_data = source_data[involved_src_sents[0]]for src_sent_id in involved_src_sents[1:]:curr_sent_data = source_data[src_sent_id]src_sent_data["id_token"].extend(curr_sent_data["id_token"])src_sent_data["form"].extend(curr_sent_data["form"])src_sent_data["lemma"].extend(curr_sent_data["lemma"])src_sent_data["msd"].extend(curr_sent_data["msd"])src_sent_data["ne_tag"].extend(curr_sent_data["ne_tag"])id_doc = src_sent_data["id_doc"]doc_title = src_sent_data["doc_title"]is_manually_validated |= src_sent_data["is_manually_validated"]for _pos, _tok in enumerate(src_sent_data["id_token"]):tok2position[_tok] = _posif len(involved_tgt_sents) > 0:tgt_sent_data = target_data[involved_tgt_sents[0]]for tgt_sent_id in involved_tgt_sents[1:]:curr_sent_data = target_data[tgt_sent_id]tgt_sent_data["id_token"].extend(curr_sent_data["id_token"])tgt_sent_data["form"].extend(curr_sent_data["form"])tgt_sent_data["lemma"].extend(curr_sent_data["lemma"])tgt_sent_data["msd"].extend(curr_sent_data["msd"])tgt_sent_data["ne_tag"].extend(curr_sent_data["ne_tag"])id_doc = tgt_sent_data["id_doc"]doc_title = tgt_sent_data["doc_title"]is_manually_validated |= tgt_sent_data["is_manually_validated"]for _pos, _tok in enumerate(tgt_sent_data["id_token"]):tok2position[_tok] = _poscorr_data = []for token_info in corrected_sent.findall(f"{NAMESPACE}link"):10 unmodified linesfor curr_tok in connections:# Token IDs have an index at the end, but it is 1-based; convert it to 0-basedidx_tok = tok2position[curr_tok[1:]]if "t" in curr_tok: # target tokentgt_inds.append(idx_tok)else: # source token5 unmodified lines"id_doc": id_doc[:-1], # doc ID without the "s" or "t" info"doc_title": doc_title,"is_manually_validated": is_manually_validated,"id_src_tokens": src_sent_data.get("id_token", []),"src_tokens": src_sent_data.get("form", []),"id_tgt_tokens": tgt_sent_data.get("id_token", []),"tgt_tokens": tgt_sent_data.get("form", []),"corrections": corr_data
README.md+5-11
dataset_infos.json+1-1
solar3.py+55-31