{"source_group": "rust", "source": "openbmb/UltraData-Stack-v3-L2/rust", "domain": "github.com", "language": "rust", "url": "https://github.com/willhagan12/riscv-assembler-rust/blob/fecddaef1bcb8151bdc3876a3ba92b625605ebde/libs/translator/src/lib.rs", "id": "rust-0-5fb5aff3c7e7b32dcf46171121fbb527", "text": "\nuse std::{mem::transmute, vec};\n\nuse data_structures::*;\npub struct Translator <'a> {\n inst_hm : HashMap>, // HashMap with instructions\n reg_hm: HashMap, // Hashmap with registers\n label_hm: HashMap, // Hashmap of labels\n curr_address : u16,\n di: &'a mut DataInterface,\n broken_line: Vec<&'a str>,\n inst_vec: Vec<&'a Inst>\n\n}\n\nimpl <'a> Translator <'a> {\n pub fn new(inst_size : u32, reg_size: u32, __di : &'a mut DataInterface) -> Self{\n Self {\n inst_hm : HashMap::new(inst_size),\n reg_hm : HashMap::new(reg_size),\n label_hm : HashMap::new(16),\n di : __di,\n curr_address: 0\n }\n }\n\n // Initializes both hashmaps\n pub fn initialize(&mut self, extracted_instuctions : &Vec::>>, extracted_regs : &Vec::>) {\n self.inst_hm.build(extracted_instuctions);\n self.reg_hm.build(extracted_regs);\n return;\n }\n\n fn gen_translate(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>, shift_arr : Vec) -> bool {\n for i in 1..shift_arr.len() {\n let reg_opt = self.reg_hm.get(broken_line[i]);\n \n if reg_opt.is_none() {\n return false;\n }\n\n let reg = reg_opt.unwrap(); \n new_parsed.instruction |= (0b11111 & reg.reg_num) << shift_arr[i];\n }\n\n true\n }\n\n fn rtype(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>) -> bool {\n \n if broken_line.len() != 4 {\n return false;\n }\n \n return self.gen_translate(new_parsed, broken_line, vec![0, 7, 15, 20]);\n \n }\n\n // i-type reg\n fn itype_regular(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>) -> bool{\n if (new_parsed.instruction & 0x7F) == 0x3 {\n return false;\n }\n\n if self.gen_translate(new_parsed, broken_line, vec![0, 7, 15]) == false {\n return false;\n }\n \n let trns_int_res = data_structures::str_to_int(broken_line[3]);\n if trns_int_res.is_err() {\n return false;\n }\n \n let trns_int : u32 = trns_int_res.unwrap();\n new_parsed.instruction |= trns_int << 20;\n\n true\n\n }\n\n // i-type ld\n fn i_type_ld(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>) -> bool{\n if (new_parsed.instruction & 0x7F) != 0x3 {\n return false;\n }\n\n let mut reg_opt = self.reg_hm.get(broken_line[1]);\n if reg_opt.is_none() {\n return false;\n }\n\n let mut reg = reg_opt.unwrap();\n new_parsed.instruction |= (0b11111 * reg.reg_num) << 7;\n \n let last_arg = broken_line[2].to_owned();\n let last_arg_split = broken_line[2].\n\n\n true\n }\n\n\n // i-type\n fn itype(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>) -> bool {\n \n // Need to consider two formats for i-type instructions.\n if broken_line.len() == 4 {\n return self.itype_regular(new_parsed, broken_line);\n\n } else if broken_line.len() == 3 {\n return self.i_type_ld(new_parsed, broken_line);\n }\n\n \n false\n }\n \n fn stype(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>) -> bool {\n \n if broken_line.len() != 3 {\n return false;\n }\n \n // Adds each of the operators, shofting them over.\n let shift_arr = [0, 15, 20];\n for i in [1, 2] {\n let reg_opt = self.reg_hm.get(broken_line[i]);\n if reg_opt.is_none() {\n return false;\n }\n\n let reg = reg_opt.unwrap(); \n new_parsed.instruction |= (0b11111 & reg.reg_num) << shift_arr[i];\n }\n let imm = u32::from_str_radix(broken_line[3], 10).expect(\"Bad immediate\");\n new_parsed.instruction |= (imm & 0b11111) << 7;\n new_parsed.instruction |= (imm & 0b111111100000) << 20;\n \n return true;\n }\n\n // Also similar to S-Type\n fn btype(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>) -> bool {\n \n if(broken_line.len() != 4) {\n return false;\n }\n \n if self.gen_translate(new_parsed, broken_line, vec![0, 15, 20]) == false {\n return false;\n }\n\n let imm_res = data_structures::str_to_int(broken_line[3]);\n if imm_res.is_err() {\n return false;\n }\n \n let imm : u32 = imm_res.unwrap();\n new_parsed.instruction |= (imm & 0b11110 | ((imm & 0x800) >> 11)) << 7;\n new_parsed.instruction |= ((imm & 0x400 >> 1) | (0b1111100000 & imm)) << 20;\n \n return true;\n }\n \n\n fn utype(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>) -> bool {\n \n // Adds each of the operators, shofting them over.\n if self.gen_translate(new_parsed, broken_line, vec![0, 7]) == false {\n return false;\n }\n \n let imm_res = data_structures::str_to_int(broken_line[3]);\n if imm_res.is_err() {\n return false;\n }\n \n let imm : u32 = imm_res.unwrap();\n new_parsed.instruction |= imm & 0xFFFFF000;\n \n return true;\n }\n \n // Needs to work with both labels and integers.\n fn jtype(&mut self, new_parsed : &mut ParsedNode, broken_line : &Vec<&str>) -> bool {\n \n if broken_line.len() != 3 {\n return false;\n }\n\n if self.gen_translate(new_parsed, broken_line, vec![0, 7]) == false {\n return false;\n }\n\n let conv_out = data_structures::str_to_int(*(broken_line.last().unwrap()));\n let imm : u32; \n if conv_out.is_err() {\n let label = *broken_line.last().unwrap();\n let out = self.label_hm.get(label);\n if out.is_none() {\n return false\n }\n imm = out.unwrap().clone() as u32;\n } else {\n imm = conv_out.unwrap() as u32;\n }\n\n // J types have a weird bit placement\n new_parsed.instruction |= imm & 0x000FF000;\n new_parsed.instruction |= (imm & 0x000800) << 9;\n new_parsed.instruction |= (imm & 0x000007FF) << 20;\n new_parsed.instruction |= (imm & 0x00100000) << 11;\n \n return true;\n }\n\n fn add_label(&mut self, label : &str) -> bool {\n let last_char = label.as_bytes()\n .last()\n .expect(\"Failed to convert to a byte.\");\n \n if *last_char != b':' {\n return false;\n }\n \n if self.label_hm.insert(&self.curr_address, label) == false {\n return false;\n }\n\n true\n }\n\n fn parse_meta(&mut self, inst_vector : &Vec, broken_line : &Vec<&str>) -> bool{\n\n match inst_vector[0].opcode {\n // Org is one\n 1 => {\n\n },\n _=> {\n return false;\n }\n }\n true\n }\n\n fn parse_psd(&mut self, ) {\n\n }\n\n\n // Parses a line, breaks the line up into a vector of strings (commas and whitespace used to split)\n // Determines the instruction type and calls the appropriate command\n // Returns a bool to indicate success\n fn parse_line(&mut self) -> bool {\n let line_opt = self.di.pop_line();\n if line_opt.is_none() {\n return false;\n } \n\n // Unwraps line object, breaks off any comment, then splits the line without comments.\n // Comments start with #\n let curr_line = line_opt.unwrap();\n let c_vec: Vec<&str> = curr_line.split(|c| c == '#')\n .collect();\n \n let uncommented_line: String = c_vec[0].to_owned();\n let broken_line: Vec<&str> = uncommented_line.split(|c| c == ',' || c == ' ' || c == '\\n')\n .filter(|s| !(*s).is_empty())\n .collect();\n\n if broken_line.len() == 0 {\n return true;\n }\n\n if broken_line.len() == 1 && broken_line[0].ends_with(|c| c == ':'){\n return self.add_label(broken_line[0]);\n } \n\n let inst_opt = self.inst_hm.get(broken_line[0]);\n if inst_opt.is_none() {\n return false;\n } \n \n // Vector of instructions that make up an instruction.\n // This so that this can work for both regular and pseudo-instructions\n let inst_vector = inst_opt.unwrap().clone();\n \n if matches!(inst_vector[0].inst_type, InstType::META) {\n self.parse_meta(&inst_vector, &broken_line);\n }\n \n if inst_vector.len() > 1 {\n for inst in inst_vector.iter() {\n // Instruction Types, (based on RISC-V Standard)\n let mut new_parsed = ParsedNode{\n instruction: inst.funct3 | inst.opcode | inst.funct7, \n address: self.curr_address\n };\n let mut success = false;\n match inst.inst_type {\n InstType::R => {\n success = self.rtype(&mut new_parsed, &broken_line);\n },\n InstType::I=> {\n success = self.itype(&mut new_parsed, &broken_line);\n },\n InstType::S=> {\n success = self.stype(&mut new_parsed, &broken_line);\n },\n InstType::B=> {\n success = self.btype(&mut new_parsed, &broken_line);\n },\n InstType::U=> {\n success = self.utype(&mut new_parsed, &broken_line);\n },\n InstType::J=>{\n success = self.jtype(&mut new_parsed, &broken_line);\n },\n _=>{\n return false;\n }\n }\n if success == false {\n return success;\n }\n\n self.di.add_parsed(&new_parsed);\n self.curr_address += 1;\n }\n } else {\n return self.parse_psd();\n }\n return true;\n }\n \n\n pub fn parse_file(&mut self) {\n let mut line_num: u32 = 1;\n\n while self.di.lines_len() > 0 {\n let success = self.parse_line();\n if !success {\n panic!(\"Failed at line #`{line_num}`\");\n }\n line_num += 1;\n }\n }\n}", "text_preview": "use std::{mem::transmute, vec}; use data_structures::*; pub struct Translator <'a> { inst_hm : HashMap>, // HashMap with instructions reg_hm: HashMap, // Hashmap with registers label_hm: HashMap, // Hashmap of labels cur", "input_sha256": "4f0825e5e9a3c76f8f32078f50c76351ee12a6c79925a53acec4305f9b5d49fe", "text_sha256": "5fb5aff3c7e7b32dcf46171121fbb52736d6254a66f5e447d9cbce86613d1b7c", "run_sha256": "0dbe3046118ab5f0eea428b55f67ac75d558dc1c7da585927c21fa1685f6e177", "line_number": 18001, "input_policy": "text-and-optional-url-v1", "label_policy_version": 12, "requested_model": "decision-models/baseten-mammoth-27b-latest", "backend": "baseten", "endpoint": "https://inference.baseten.co/v1/systemone", "status": "ok", "training_eligible": true, "label": {"primary": {"main_format": "Technical Writing", "sub_format": null}, "secondary": null, "tertiary": null, "content_structure": []}, "candidate_label": null, "topic": {"primary": {"main_topic": "Programming & Software Engineering", "sub_topic": null}, "secondary": null}, "scores": {"content_quality": 0, "noise_severity": 0, "missing_content_severity": 0, "factual_density": 4, "pretraining_utility": 0, "math_density": 0, "code_density": 4, "reasoning_density": 0, "education_level": 3, "creative_writing_quality": null}, "score_expectations": {"content_quality": 0.0063404135088558355, "noise_severity": 0.04186510093964259, "missing_content_severity": 0.08987939609420285, "factual_density": 3.344248564214449, "pretraining_utility": 0.40370283489088554, "math_density": 1.183001454269855, "code_density": 3.9103886605239766, "reasoning_density": 1.2628847242887737, "education_level": 2.691861124525287, "creative_writing_quality": -0.6905186471112923}, "api_choices": {"primary": "Technical Writing", "secondary": "NONE", "tertiary": "NONE", "education_level": "3", "creative_writing_quality": "not_applicable", "primary_topic": "Programming & Software Engineering", "secondary_topic": "NONE"}, "review_reasons": [], "format_slot_diagnostics": {"comparable": true, "secondary_tertiary_identical": false, "secondary_tertiary_max_abs_gap": 0.004672946576072756, "secondary_choice": "NONE", "tertiary_choice": "NONE"}, "confidence": {"primary": 0.9974815400813615, "secondary": 0.9893979909730778, "tertiary": 0.9942741091394143, "structured_records": 0.007499123265905529, "procedural_steps": 0.010583233325400733, "worked_solution": 0.0016049692328152039, "contextual_dialogue": 5.146046760456048e-06, "content_quality": 0.40425226190466435, "noise_severity": 0.9651124158836312, "missing_content_severity": 0.925100503254831, "factual_density": 0.45354047017870724, "pretraining_utility": 0.41923293334095657, "math_density": 0.014165454775120767, "code_density": 0.9253238837699804, "reasoning_density": 0.0, "education_level": 0.3408439135913838, "creative_writing_quality": 0.999568009450921, "primary_topic": 0.9807462855549629, "secondary_topic": 0.8174687202647484}, "probability_margin": {"primary": 0.9963559309379327, "secondary": 0.9837292441281069, "tertiary": 0.9913903295346664, "education_level": 0.028828268230375764, "creative_writing_quality": 0.9995312652693708, "primary_topic": 0.9718089587184128, "secondary_topic": 0.7482505177609146}, "raw_probabilities": {"primary": {"Academic Writing": 3.9187014489248996e-05, "Content Listing": 1.7640800684258577e-05, "Creative Writing": 1.700203415329629e-05, "Customer Support Page": 6.172957196825568e-06, "Q&A Forum": 1.1110814436562953e-05, "Discussion Thread": 7.378831128711467e-06, "Comment Section": 1.2081736168625822e-05, "Missing Content": 3.431967810596787e-05, "Knowledge Article": 0.00010333490242400409, "Legal Notices": 3.140149560700711e-05, "News Article": 3.9063377727355875e-06, "Organizational Announcement": 8.905757141435982e-06, "Nonfiction Writing": 1.1431849229386858e-05, "Organizational About Page": 9.586546365502031e-06, "Personal About Page": 1.1515183117472138e-05, "Personal Blog": 6.653252389989692e-06, "Product Page": 6.1273463530996455e-06, "Spam / Ads": 1.0098582559525973e-05, "Structured Data": 0.0004840055912675555, "Technical Writing": 0.9975864759113048, "Transcript / Interview": 1.5256041117595454e-05, "Tutorial / How-To Guide": 0.0003302863858262759, "User Reviews": 5.57597778791708e-06, "Other / Unknown": 0.0012305449733720601}, "secondary": {"Academic Writing": 7.733904158463538e-05, "Content Listing": 4.210109223012283e-05, "Creative Writing": 4.9566729816986764e-05, "Customer Support Page": 2.2830275405433993e-05, "Q&A Forum": 2.0449611595911593e-05, "Discussion Thread": 2.0328172188697666e-05, "Comment Section": 4.8315241121423054e-05, "Missing Content": 0.0006189737836148255, "Knowledge Article": 0.00039935015094545994, "Legal Notices": 7.491186702785953e-05, "News Article": 2.9048700096175325e-05, "Organizational Announcement": 2.6079085571190127e-05, "Nonfiction Writing": 3.519597346172814e-05, "Organizational About Page": 3.504227796357759e-05, "Personal About Page": 3.0093746183568125e-05, "Personal Blog": 2.4184763588401294e-05, "Product Page": 1.6871509593714958e-05, "Spam / Ads": 3.260506060447046e-05, "Structured Data": 0.0019515929916489754, "Technical Writing": 0.006110497221092626, "Transcript / Interview": 3.573223225484265e-05, "Tutorial / How-To Guide": 0.0004450730701864621, "User Reviews": 1.4076053023526085e-05, "NONE": 0.9898397413491995}, "tertiary": {"Academic Writing": 5.4094177604622484e-05, "Content Listing": 3.465748488105983e-05, "Creative Writing": 4.3735314590788966e-05, "Customer Support Page": 1.5950106921496913e-05, "Q&A Forum": 1.2271605102958808e-05, "Discussion Thread": 1.3681050577495083e-05, "Comment Section": 3.714577849028416e-05, "Missing Content": 0.0005983099068292602, "Knowledge Article": 0.0002466863673706235, "Legal Notices": 9.112871166311888e-05, "News Article": 2.2597169175728338e-05, "Organizational Announcement": 1.9660359550690685e-05, "Nonfiction Writing": 3.0278984247058513e-05, "Organizational About Page": 3.046639142290989e-05, "Personal About Page": 2.075989430145266e-05, "Personal Blog": 1.6713360823373923e-05, "Product Page": 1.4033785291361555e-05, "Spam / Ads": 2.3260113948800612e-05, "Structured Data": 0.0006706532451424365, "Technical Writing": 0.003122358390605633, "Transcript / Interview": 2.4371113595245732e-05, "Tutorial / How-To Guide": 0.00033289768428197117, "User Reviews": 1.160107830963093e-05, "NONE": 0.994512687925272}, "structured_records": {"false": 0.9925008767340945, "true": 0.007499123265905529}, "procedural_steps": {"false": 0.9894167666745992, "true": 0.010583233325400733}, "worked_solution": {"false": 0.9983950307671848, "true": 0.0016049692328152039}, "contextual_dialogue": {"false": 0.9999948539532395, "true": 5.146046760456048e-06}, "content_quality": {"-2": 0.05323144566263255, "-1": 0.2478155447775084, "0": 0.3961361613569411, "1": 0.2450148467942064, "2": 0.05780200140871146}, "noise_severity": {"0": 0.9674192101265736, "1": 0.025734029328086154, "2": 0.005019337612311857, "3": 0.0012172953451808717, "4": 0.0006101275878475265}, "missing_content_severity": {"0": 0.9448266021864214, "1": 0.027972669316139207, "2": 0.020697338899399013, "3": 0.005501509412895674, "4": 0.0010018801851446513}, "factual_density": {"0": 0.0076665176341233965, "1": 0.013985867185850775, "2": 0.10184016939185196, "3": 0.3794474249078015, "4": 0.4970600208803724}, "pretraining_utility": {"-2": 0.01696735480204963, "-1": 0.112674112945884, "0": 0.3974934532011713, "1": 0.39541850066092127, "2": 0.07744657838997376}, "math_density": {"0": 0.4403126529989984, "1": 0.25568396947681427, "2": 0.11136139112038394, "3": 0.06597324306294065, "4": 0.12666874334086273}, "code_density": {"0": 0.0002398476872161875, "1": 0.0004304314665503964, "2": 0.009523179147974063, "3": 0.06831429603155935, "4": 0.9214922456667}, "reasoning_density": {"0": 0.505146004652066, "1": 0.09601435002514006, "2": 0.14766345052692195, "3": 0.13316130597369774, "4": 0.11801488882217416}, "education_level": {"none": 0.001047804454607315, "0": 0.001005186449267405, "1": 0.002764736139656008, "2": 0.4218749930957774, "3": 0.4507032613261532, "4": 0.12260401853453863}, "creative_writing_quality": {"not_applicable": 0.9996400078757675, "-2": 9.85539455216728e-05, "-1": 0.00010874260639674548, "0": 0.0001081632515032211, "1": 3.1795418777585576e-05, "2": 1.2736902033352827e-05}, "primary_topic": {"Adult & Explicit Sexual Content": 4.9990079806690635e-05, "Art & Design": 5.605664933169356e-05, "Law & Crime": 3.894436344220891e-05, "Education & Careers": 4.501952839570376e-05, "Entertainment & Media": 3.753715642745111e-05, "Fashion & Beauty": 2.900241397960956e-05, "Business, Economics & Finance": 4.359663405788025e-05, "Food & Dining": 3.419431999149556e-05, "Games & Gaming": 7.986236312516042e-05, "Electronics & Hardware": 0.0074067361924886645, "Health, Healthcare & Wellness": 3.537490690944854e-05, "History & Geography": 4.6099092272067456e-05, "Home, Pets & Hobbies": 2.9282210556125312e-05, "Industry & Production": 3.755097708480376e-05, "Language, Literature & Philosophy": 8.163182303859227e-05, "Politics & Government": 2.2402204031080147e-05, "Religion & Spirituality": 3.461219307810491e-05, "Science, Mathematics & Engineering": 0.00967785431520545, "Relationships & Community": 2.20899591831155e-05, "Software Usage & Applications": 0.0002145617093214045, "Programming & Software Engineering": 0.9814868130336182, "Sports & Fitness": 5.380842854443512e-05, "Vehicles & Transportation": 2.2585433372642017e-05, "Travel & Tourism": 4.576349329392204e-05, "Other / Uncovered Subject": 0.0002828384486806211, "Unknown / Insufficient Content": 8.579207076372804e-05}, "secondary_topic": {"Adult & Explicit Sexual Content": 0.0005871319818965548, "Art & Design": 0.0004467981029425412, "Law & Crime": 0.0004504709713598178, "Education & Careers": 0.0003807337447596746, "Entertainment & Media": 0.00038848378694175846, "Fashion & Beauty": 0.0002040855753147102, "Business, Economics & Finance": 0.00041336948646680577, "Food & Dining": 0.00018001980040623132, "Games & Gaming": 0.00038770561841701173, "Electronics & Hardware": 0.0416293683454751, "Health, Healthcare & Wellness": 0.0003003704019623325, "History & Geography": 0.00030565650860396327, "Home, Pets & Hobbies": 0.00020615804745182284, "Industry & Production": 0.00018371109254308523, "Language, Literature & Philosophy": 0.0002561272968340219, "Politics & Government": 0.00022165980596727282, "Religion & Spirituality": 0.00031493456452504954, "Science, Mathematics & Engineering": 0.07623863633980495, "Relationships & Community": 0.00016904047283668197, "Software Usage & Applications": 0.0005125345954215738, "Programming & Software Engineering": 0.05025297660766929, "Sports & Fitness": 0.00022997967042225835, "Vehicles & Transportation": 0.00011970240216722402, "Travel & Tourism": 0.00037417403158296916, "Other / Uncovered Subject": 0.0007570166475076487, "NONE": 0.8244891541007195}}, "probabilities": {"primary": {"Academic Writing": 3.9187014489249e-05, "Content Listing": 1.764080068425858e-05, "Creative Writing": 1.7002034153296294e-05, "Customer Support Page": 6.1729571968255685e-06, "Q&A Forum": 1.1110814436562955e-05, "Discussion Thread": 7.378831128711468e-06, "Comment Section": 1.2081736168625823e-05, "Missing Content": 3.4319678105967877e-05, "Knowledge Article": 0.0001033349024240041, "Legal Notices": 3.1401495607007114e-05, "News Article": 3.906337772735588e-06, "Organizational Announcement": 8.905757141435984e-06, "Nonfiction Writing": 1.143184922938686e-05, "Organizational About Page": 9.586546365502033e-06, "Personal About Page": 1.151518311747214e-05, "Personal Blog": 6.653252389989693e-06, "Product Page": 6.127346353099646e-06, "Spam / Ads": 1.0098582559525975e-05, "Structured Data": 0.00048400559126755556, "Technical Writing": 0.9975864759113049, "Transcript / Interview": 1.5256041117595456e-05, "Tutorial / How-To Guide": 0.00033028638582627593, "User Reviews": 5.5759777879170805e-06, "Other / Unknown": 0.0012305449733720603}, "secondary": {"Academic Writing": 7.733904158463537e-05, "Content Listing": 4.2101092230122827e-05, "Creative Writing": 4.956672981698675e-05, "Customer Support Page": 2.283027540543399e-05, "Q&A Forum": 2.044961159591159e-05, "Discussion Thread": 2.0328172188697663e-05, "Comment Section": 4.831524112142304e-05, "Missing Content": 0.0006189737836148254, "Knowledge Article": 0.00039935015094545983, "Legal Notices": 7.491186702785952e-05, "News Article": 2.9048700096175318e-05, "Organizational Announcement": 2.607908557119012e-05, "Nonfiction Writing": 3.5195973461728135e-05, "Organizational About Page": 3.5042277963577585e-05, "Personal About Page": 3.009374618356812e-05, "Personal Blog": 2.4184763588401288e-05, "Product Page": 1.6871509593714955e-05, "Spam / Ads": 3.2605060604470454e-05, "Structured Data": 0.001951592991648975, "Technical Writing": 0.006110497221092625, "Transcript / Interview": 3.5732232254842646e-05, "Tutorial / How-To Guide": 0.000445073070186462, "User Reviews": 1.4076053023526081e-05, "NONE": 0.9898397413491993}, "tertiary": {"Academic Writing": 5.4094177604622484e-05, "Content Listing": 3.465748488105983e-05, "Creative Writing": 4.3735314590788966e-05, "Customer Support Page": 1.5950106921496913e-05, "Q&A Forum": 1.2271605102958808e-05, "Discussion Thread": 1.3681050577495083e-05, "Comment Section": 3.714577849028416e-05, "Missing Content": 0.0005983099068292602, "Knowledge Article": 0.0002466863673706235, "Legal Notices": 9.112871166311888e-05, "News Article": 2.2597169175728338e-05, "Organizational Announcement": 1.9660359550690685e-05, "Nonfiction Writing": 3.0278984247058513e-05, "Organizational About Page": 3.046639142290989e-05, "Personal About Page": 2.075989430145266e-05, "Personal Blog": 1.6713360823373923e-05, "Product Page": 1.4033785291361555e-05, "Spam / Ads": 2.3260113948800612e-05, "Structured Data": 0.0006706532451424365, "Technical Writing": 0.003122358390605633, "Transcript / Interview": 2.4371113595245732e-05, "Tutorial / How-To Guide": 0.00033289768428197117, "User Reviews": 1.160107830963093e-05, "NONE": 0.994512687925272}, "structured_records": {"false": 0.9925008767340945, "true": 0.007499123265905529}, "procedural_steps": {"false": 0.9894167666745992, "true": 0.010583233325400733}, "worked_solution": {"false": 0.9983950307671848, "true": 0.0016049692328152039}, "contextual_dialogue": {"false": 0.9999948539532395, "true": 5.146046760456048e-06}, "content_quality": {"-2": 0.053231445662632555, "-1": 0.24781554477750842, "0": 0.39613616135694113, "1": 0.24501484679420643, "2": 0.057802001408711466}, "noise_severity": {"0": 0.9674192101265736, "1": 0.025734029328086154, "2": 0.005019337612311857, "3": 0.0012172953451808717, "4": 0.0006101275878475265}, "missing_content_severity": {"0": 0.9448266021864214, "1": 0.027972669316139207, "2": 0.020697338899399013, "3": 0.005501509412895674, "4": 0.0010018801851446513}, "factual_density": {"0": 0.0076665176341233965, "1": 0.013985867185850775, "2": 0.10184016939185196, "3": 0.3794474249078015, "4": 0.4970600208803724}, "pretraining_utility": {"-2": 0.01696735480204963, "-1": 0.112674112945884, "0": 0.3974934532011713, "1": 0.39541850066092127, "2": 0.07744657838997376}, "math_density": {"0": 0.4403126529989984, "1": 0.25568396947681427, "2": 0.11136139112038394, "3": 0.06597324306294065, "4": 0.12666874334086273}, "code_density": {"0": 0.0002398476872161875, "1": 0.0004304314665503964, "2": 0.009523179147974063, "3": 0.06831429603155935, "4": 0.9214922456667}, "reasoning_density": {"0": 0.505146004652066, "1": 0.09601435002514006, "2": 0.14766345052692195, "3": 0.13316130597369774, "4": 0.11801488882217416}, "education_level": {"none": 0.001047804454607315, "0": 0.001005186449267405, "1": 0.002764736139656008, "2": 0.4218749930957774, "3": 0.4507032613261532, "4": 0.12260401853453863}, "creative_writing_quality": {"not_applicable": 0.9996400078757675, "-2": 9.85539455216728e-05, "-1": 0.00010874260639674548, "0": 0.0001081632515032211, "1": 3.1795418777585576e-05, "2": 1.2736902033352827e-05}, "primary_topic": {"Adult & Explicit Sexual Content": 4.999007980669062e-05, "Art & Design": 5.6056649331693544e-05, "Law & Crime": 3.89443634422089e-05, "Education & Careers": 4.5019528395703755e-05, "Entertainment & Media": 3.75371564274511e-05, "Fashion & Beauty": 2.9002413979609552e-05, "Business, Economics & Finance": 4.359663405788024e-05, "Food & Dining": 3.419431999149555e-05, "Games & Gaming": 7.986236312516041e-05, "Electronics & Hardware": 0.007406736192488663, "Health, Healthcare & Wellness": 3.537490690944853e-05, "History & Geography": 4.609909227206744e-05, "Home, Pets & Hobbies": 2.9282210556125305e-05, "Industry & Production": 3.755097708480375e-05, "Language, Literature & Philosophy": 8.163182303859225e-05, "Politics & Government": 2.2402204031080144e-05, "Religion & Spirituality": 3.46121930781049e-05, "Science, Mathematics & Engineering": 0.009677854315205448, "Relationships & Community": 2.2089959183115497e-05, "Software Usage & Applications": 0.00021456170932140445, "Programming & Software Engineering": 0.981486813033618, "Sports & Fitness": 5.3808428544435104e-05, "Vehicles & Transportation": 2.2585433372642014e-05, "Travel & Tourism": 4.5763493293922036e-05, "Other / Uncovered Subject": 0.000282838448680621, "Unknown / Insufficient Content": 8.579207076372803e-05}, "secondary_topic": {"Adult & Explicit Sexual Content": 0.0005871319818965549, "Art & Design": 0.00044679810294254125, "Law & Crime": 0.00045047097135981785, "Education & Careers": 0.00038073374475967463, "Entertainment & Media": 0.0003884837869417585, "Fashion & Beauty": 0.00020408557531471021, "Business, Economics & Finance": 0.0004133694864668058, "Food & Dining": 0.00018001980040623135, "Games & Gaming": 0.0003877056184170118, "Electronics & Hardware": 0.04162936834547511, "Health, Healthcare & Wellness": 0.00030037040196233256, "History & Geography": 0.0003056565086039633, "Home, Pets & Hobbies": 0.00020615804745182287, "Industry & Production": 0.00018371109254308526, "Language, Literature & Philosophy": 0.00025612729683402197, "Politics & Government": 0.00022165980596727285, "Religion & Spirituality": 0.0003149345645250496, "Science, Mathematics & Engineering": 0.07623863633980496, "Relationships & Community": 0.000169040472836682, "Software Usage & Applications": 0.000512534595421574, "Programming & Software Engineering": 0.050252976607669295, "Sports & Fitness": 0.00022997967042225837, "Vehicles & Transportation": 0.00011970240216722403, "Travel & Tourism": 0.0003741740315829692, "Other / Uncovered Subject": 0.0007570166475076488, "NONE": 0.8244891541007197}}, "probability_diagnostics": {"primary": {"raw_sum": 0.9999999999999999, "mass_delta": -1.1102230246251565e-16, "missing_mass": 1.1102230246251565e-16, "excess_mass": 0.0, "valid": true, "normalized": false}, "secondary": {"raw_sum": 1.0000000000000002, "mass_delta": 2.220446049250313e-16, "missing_mass": 0.0, "excess_mass": 2.220446049250313e-16, "valid": true, "normalized": false}, "tertiary": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "structured_records": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "procedural_steps": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "worked_solution": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "contextual_dialogue": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "content_quality": {"raw_sum": 0.9999999999999999, "mass_delta": -1.1102230246251565e-16, "missing_mass": 1.1102230246251565e-16, "excess_mass": 0.0, "valid": true, "normalized": false}, "noise_severity": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "missing_content_severity": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "factual_density": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "pretraining_utility": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "math_density": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "code_density": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "reasoning_density": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "education_level": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "creative_writing_quality": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "primary_topic": {"raw_sum": 1.0000000000000002, "mass_delta": 2.220446049250313e-16, "missing_mass": 0.0, "excess_mass": 2.220446049250313e-16, "valid": true, "normalized": false}, "secondary_topic": {"raw_sum": 0.9999999999999999, "mass_delta": -1.1102230246251565e-16, "missing_mass": 1.1102230246251565e-16, "excess_mass": 0.0, "valid": true, "normalized": false}}, "usage": {"input_tokens": 11415, "output_tokens": 19}, "cache": {"status": "unreported", "cached_tokens": null, "cache_write_tokens": null, "input_tokens": 11415, "cached_share": null, "cache_discount_reported": null, "reported_cost_usd": null}, "response_metadata": {"model": "decision-models/baseten-mammoth-27b-latest"}, "scored_at_utc": "2026-10-25T18:29:05.184124+00:00", "scoring_key_slot": "assistant_1", "dataset_uid": "d458d851-8780-4b5e-be46-97eedb988338", "dataset_revision": "62077439f2c81c79b71c084d1057ee1d042369a3", "dataset_config": "default", "content_variant": "content", "source_record_sha256": "9323abc55e5eb4b4d0438d1d5a2b345202c9a6611b2684ec46da2f0aead00944", "source_metadata": {"uuid": "d458d851-8780-4b5e-be46-97eedb988338", "repo_name": "willhagan12/riscv-assembler-rust", "relative_path": "libs/translator/src/lib.rs", "category": "TOOL", "algo_rel_score": 0.7226983904838562, "quality_score": 5.6786370277404785, "source_meta": {"github_metadata": {"branch": "master", "commit_count": 9, "repo_created_at": "2024-12-18T16:17:17.000Z", "is_fork": false, "is_org_owned": false, "forked_from": null, "stars": 0, "forks": 0, "issues": 0, "pull_requests": 0}, "file_meta": {"content_id": "e04cfe29d21d3176e839a75189aa3b40d1fdb524", "size_bytes": 10680, "file_timestamp": 1737753312, "language": "rust", "is_vendor": false, "license_type": "no_license", "detected_licenses": []}, "commit_id": "fecddaef1bcb8151bdc3876a3ba92b625605ebde"}}, "parsed_source_meta": {"github_metadata": {"branch": "master", "commit_count": 9, "repo_created_at": "2024-12-18T16:17:17.000Z", "is_fork": false, "is_org_owned": false, "forked_from": null, "stars": 0, "forks": 0, "issues": 0, "pull_requests": 0}, "file_meta": {"content_id": "e04cfe29d21d3176e839a75189aa3b40d1fdb524", "size_bytes": 10680, "file_timestamp": 1737753312, "language": "rust", "is_vendor": false, "license_type": "no_license", "detected_licenses": []}, "commit_id": "fecddaef1bcb8151bdc3876a3ba92b625605ebde", "url": "https://github.com/willhagan12/riscv-assembler-rust/blob/fecddaef1bcb8151bdc3876a3ba92b625605ebde/libs/translator/src/lib.rs"}, "gpt4o_tokens": 2631, "dataset_split": "rust", "probability_weighted_scores": {"content_quality": 0.0063404135088558355, "noise_severity": 0.04186510093964259, "missing_content_severity": 0.08987939609420285, "factual_density": 3.344248564214449, "pretraining_utility": 0.40370283489088554, "math_density": 1.183001454269855, "code_density": 3.9103886605239766, "reasoning_density": 1.2628847242887737, "education_level": 2.691861124525287, "creative_writing_quality": -0.6905186471112923}, "score_applicability": {"education_level": 0.9989521955453926, "creative_writing_quality": 0.0003599921242325778}} {"source_group": "rust", "source": "openbmb/UltraData-Stack-v3-L2/rust", "domain": "github.com", "language": "rust", "url": "https://github.com/petgraph/petgraph/blob/46c4cb8e59294ab1330010de6d4b3744928b07e5/src/algo/page_rank.rs", "id": "rust-0-d61266da04832c0860fee8c39725574c", "text": "use alloc::{vec, vec::Vec};\n\nuse super::UnitMeasure;\nuse crate::visit::{EdgeRef, IntoEdges, NodeCount, NodeIndexable};\n\n#[cfg(feature = \"rayon\")]\nuse rayon::prelude::*;\n\n/// Page Rank algorithm.\n///\n/// Computes the ranks of every node in a graph using the [Page Rank algorithm][pr].\n///\n/// # Arguments\n/// * `graph`: a directed graph.\n/// * `damping_factor`: a value in range `0.0 <= damping_factor <= 1.0`.\n/// * `nb_iter`: number of iterations of the main loop.\n///\n/// # Returns\n/// * A `Vec` mapping each node index to its rank.\n///\n/// # Panics\n/// The damping factor should be a measure (like `f32` or `f64`) between 0 and 1 (0 and 1 included). Otherwise, it panics.\n///\n/// # Complexity\n/// * Time complexity: **O(n|V|²|E|)**.\n/// * Auxiliary space: **O(|V| + |E|)**.\n///\n/// where **n** is the number of iterations, **|V|** the number of vertices (i.e nodes) and **|E|** the number of edges.\n///\n/// [pr]: https://en.wikipedia.org/wiki/PageRank\n///\n/// # Example\n/// ```rust\n/// use petgraph::Graph;\n/// use petgraph::algo::page_rank;\n/// let mut g: Graph<(), usize> = Graph::new();\n/// assert_eq!(page_rank(&g, 0.5_f64, 1), vec![]); // empty graphs have no node ranks.\n/// let a = g.add_node(());\n/// let b = g.add_node(());\n/// let c = g.add_node(());\n/// let d = g.add_node(());\n/// let e = g.add_node(());\n/// g.extend_with_edges(&[(0, 1), (0, 3), (1, 2), (1, 3)]);\n/// // With the following dot representation.\n/// //digraph {\n/// // 0 [ label = \"()\" ]\n/// // 1 [ label = \"()\" ]\n/// // 2 [ label = \"()\" ]\n/// // 3 [ label = \"()\" ]\n/// // 4 [ label = \"()\" ]\n/// // 0 -> 1 [ label = \"0.0\" ]\n/// // 0 -> 3 [ label = \"0.0\" ]\n/// // 1 -> 2 [ label = \"0.0\" ]\n/// // 1 -> 3 [ label = \"0.0\" ]\n/// //}\n/// let damping_factor = 0.7_f32;\n/// let number_iterations = 10;\n/// let output_ranks = page_rank(&g, damping_factor, number_iterations);\n/// let expected_ranks = vec![0.14685437, 0.20267677, 0.22389607, 0.27971846, 0.14685437];\n/// assert_eq!(expected_ranks, output_ranks);\n/// ```\n#[track_caller]\npub fn page_rank(graph: G, damping_factor: D, nb_iter: usize) -> Vec\nwhere\n G: NodeCount + IntoEdges + NodeIndexable,\n D: UnitMeasure + Copy,\n{\n let node_count = graph.node_count();\n if node_count == 0 {\n return vec![];\n }\n assert!(\n D::zero() <= damping_factor && damping_factor <= D::one(),\n \"Damping factor should be between 0 et 1.\"\n );\n let nb = D::from_usize(node_count);\n let mut ranks = vec![D::one() / nb; node_count];\n let nodeix = |i| graph.from_index(i);\n let out_degrees: Vec = (0..node_count)\n .map(|i| graph.edges(nodeix(i)).map(|_| D::one()).sum::())\n .collect();\n\n for _ in 0..nb_iter {\n let pi = (0..node_count)\n .enumerate()\n .map(|(v, _)| {\n ranks\n .iter()\n .enumerate()\n .map(|(w, r)| {\n let mut w_out_edges = graph.edges(nodeix(w));\n if w_out_edges.any(|e| e.target() == nodeix(v)) {\n damping_factor * *r / out_degrees[w]\n } else if out_degrees[w] == D::zero() {\n damping_factor * *r / nb // stochastic matrix condition\n } else {\n (D::one() - damping_factor) * *r / nb // random jumps\n }\n })\n .sum::()\n })\n .collect::>();\n let sum = pi.iter().copied().sum::();\n ranks = pi.iter().map(|r| *r / sum).collect::>();\n }\n ranks\n}\n\n#[allow(dead_code)]\nfn out_edges_info(graph: G, index_w: usize, index_v: usize) -> (D, bool)\nwhere\n G: NodeCount + IntoEdges + NodeIndexable + core::marker::Sync,\n D: UnitMeasure + Copy + core::marker::Send + core::marker::Sync,\n{\n let node_w = graph.from_index(index_w);\n let node_v = graph.from_index(index_v);\n let mut out_edges = graph.edges(node_w);\n let mut out_edge = out_edges.next();\n let mut out_degree = D::zero();\n let mut flag_points_to = false;\n while let Some(edge) = out_edge {\n out_degree = out_degree + D::one();\n if edge.target() == node_v {\n flag_points_to = true;\n }\n out_edge = out_edges.next();\n }\n (out_degree, flag_points_to)\n}\n/// Parallel Page Rank algorithm.\n///\n/// See [`page_rank`].\n#[cfg(feature = \"rayon\")]\npub fn parallel_page_rank(\n graph: G,\n damping_factor: D,\n nb_iter: usize,\n tol: Option,\n) -> Vec\nwhere\n G: NodeCount + IntoEdges + NodeIndexable + core::marker::Sync,\n D: UnitMeasure + Copy + core::marker::Send + core::marker::Sync,\n{\n let node_count = graph.node_count();\n if node_count == 0 {\n return vec![];\n }\n assert!(\n D::zero() <= damping_factor && damping_factor <= D::one(),\n \"Damping factor should be between 0 et 1.\"\n );\n let mut tolerance = D::default_tol();\n if let Some(_tol) = tol {\n tolerance = _tol;\n }\n let nb = D::from_usize(node_count);\n let mut ranks: Vec = (0..node_count)\n .into_par_iter()\n .map(|_| D::one() / nb)\n .collect();\n for _ in 0..nb_iter {\n let pi = (0..node_count)\n .into_par_iter()\n .map(|v| {\n ranks\n .iter()\n .enumerate()\n .map(|(w, r)| {\n let (out_deg, w_points_to_v) = out_edges_info(graph, w, v);\n if w_points_to_v {\n damping_factor * *r / out_deg\n } else if out_deg == D::zero() {\n damping_factor * *r / nb // stochastic matrix condition\n } else {\n (D::one() - damping_factor) * *r / nb // random jumps\n }\n })\n .sum::()\n })\n .collect::>();\n let sum = pi.par_iter().map(|score| *score).sum::();\n let new_ranks = pi.par_iter().map(|r| *r / sum).collect::>();\n let squared_norm_2 = new_ranks\n .par_iter()\n .zip(&ranks)\n .map(|(new, old)| (*new - *old) * (*new - *old))\n .sum::();\n if squared_norm_2 <= tolerance {\n return ranks;\n } else {\n ranks = new_ranks;\n }\n }\n ranks\n}\n", "text_preview": "use alloc::{vec, vec::Vec}; use super::UnitMeasure; use crate::visit::{EdgeRef, IntoEdges, NodeCount, NodeIndexable}; #[cfg(feature = \"rayon\")] use rayon::prelude::*; /// Page Rank algorithm. /// /// Computes the ranks of every node in a gr", "input_sha256": "8ee5bc598eb60968c414e569db62c9a02a3487672e0834e6879fc97ab8636018", "text_sha256": "d61266da04832c0860fee8c39725574cbbbeea5b7cc915bd426b6ded4342a6c9", "run_sha256": "0dbe3046118ab5f0eea428b55f67ac75d558dc1c7da585927c21fa1685f6e177", "line_number": 18003, "input_policy": "text-and-optional-url-v1", "label_policy_version": 12, "requested_model": "decision-models/baseten-mammoth-27b-latest", "backend": "baseten", "endpoint": "https://inference.baseten.co/v1/systemone", "status": "needs_review", "training_eligible": false, "label": null, "candidate_label": {"primary": {"main_format": "Technical Writing", "sub_format": null}, "secondary": null, "tertiary": null, "content_structure": []}, "topic": {"primary": {"main_topic": "Programming & Software Engineering", "sub_topic": null}, "secondary": {"main_topic": "Science, Mathematics & Engineering", "sub_topic": null}}, "scores": {"content_quality": 1, "noise_severity": 0, "missing_content_severity": 0, "factual_density": 4, "pretraining_utility": 1, "math_density": 3, "code_density": 4, "reasoning_density": 0, "education_level": 2, "creative_writing_quality": null}, "score_expectations": {"content_quality": 1.3487005462183692, "noise_severity": 0.029587639040997173, "missing_content_severity": 0.011017473949886886, "factual_density": 3.3400507864426774, "pretraining_utility": 0.9867946352008028, "math_density": 3.0607645003990083, "code_density": 3.6073200195512793, "reasoning_density": 1.6574942957900451, "education_level": 2.5596470546958088, "creative_writing_quality": -0.04556747284068704}, "api_choices": {"primary": "Technical Writing", "secondary": "NONE", "tertiary": "NONE", "education_level": "2", "creative_writing_quality": "not_applicable", "primary_topic": "Programming & Software Engineering", "secondary_topic": "Science, Mathematics & Engineering"}, "review_reasons": ["secondary_topic probability 0.4912 below 0.70"], "format_slot_diagnostics": {"comparable": true, "secondary_tertiary_identical": false, "secondary_tertiary_max_abs_gap": 0.03935183906834927, "secondary_choice": "NONE", "tertiary_choice": "NONE"}, "confidence": {"primary": 0.9979593498366426, "secondary": 0.8797320938366785, "tertiary": 0.9207948824297387, "structured_records": 0.01022373183323472, "procedural_steps": 0.07217214811719887, "worked_solution": 0.23053162931944657, "contextual_dialogue": 5.573346048679192e-06, "content_quality": 0.5562875041445493, "noise_severity": 0.9753436341325024, "missing_content_severity": 0.9908187717084276, "factual_density": 0.4500423220355646, "pretraining_utility": 0.6444385122000975, "math_density": 0.4238088664804557, "code_density": 0.6727666829593993, "reasoning_density": 0.0, "education_level": 0.41762567736202444, "creative_writing_quality": 0.9993597886988075, "primary_topic": 0.88797927867666, "secondary_topic": 0.4708837253137249}, "probability_margin": {"primary": 0.9972210296169672, "secondary": 0.8356452242826385, "tertiary": 0.8864223013201477, "education_level": 0.11989364572638983, "creative_writing_quality": 0.9991839759408417, "primary_topic": 0.7885370171538061, "secondary_topic": 0.1693323585803987}, "raw_probabilities": {"primary": {"Academic Writing": 7.243981038482502e-05, "Content Listing": 1.0329604854183751e-05, "Creative Writing": 5.4332084926238396e-06, "Customer Support Page": 8.554262548874271e-06, "Q&A Forum": 7.812278410036726e-06, "Discussion Thread": 3.876207129732728e-06, "Comment Section": 6.4733088309387425e-06, "Missing Content": 9.661902235519874e-06, "Knowledge Article": 0.000443558933964118, "Legal Notices": 1.0483080782053033e-05, "News Article": 2.2191311115223817e-06, "Organizational Announcement": 5.7635395537225705e-06, "Nonfiction Writing": 9.037932879260877e-06, "Organizational About Page": 6.638970441145203e-06, "Personal About Page": 4.3907161733466544e-06, "Personal Blog": 3.8335551192584615e-06, "Product Page": 4.617350624738864e-06, "Spam / Ads": 5.159921053119857e-06, "Structured Data": 0.00013213813823807256, "Technical Writing": 0.9980443769267825, "Transcript / Interview": 7.618832348525174e-06, "Tutorial / How-To Guide": 0.0008233473098152121, "User Reviews": 3.2756613463618995e-06, "Other / Unknown": 0.0003689594168803734}, "secondary": {"Academic Writing": 0.006391522264628544, "Content Listing": 0.00038868158314915075, "Creative Writing": 0.00036092354911624057, "Customer Support Page": 0.0004330308164634689, "Q&A Forum": 0.00028012001913941506, "Discussion Thread": 0.0001741584510035319, "Comment Section": 0.0003095691027091696, "Missing Content": 0.0004951988505565498, "Knowledge Article": 0.01189965249766896, "Legal Notices": 0.00036520586363565974, "News Article": 0.0002495122201699415, "Organizational Announcement": 0.00024788979774331466, "Nonfiction Writing": 0.0003284471374936452, "Organizational About Page": 0.00028142752173667936, "Personal About Page": 0.00023048143012352912, "Personal Blog": 0.00019494323695215966, "Product Page": 0.0001616603269814821, "Spam / Ads": 0.00021702871804268797, "Structured Data": 0.0012560611049302127, "Technical Writing": 0.041399492093679185, "Transcript / Interview": 0.00036617556199914297, "Tutorial / How-To Guide": 0.04909803231084502, "User Reviews": 0.00012752894774871421, "NONE": 0.8847432565934835}, "tertiary": {"Academic Writing": 0.007577397854526017, "Content Listing": 0.00021596600716705463, "Creative Writing": 0.00022575884084242973, "Customer Support Page": 0.0002542127901069729, "Q&A Forum": 0.00013504680648631915, "Discussion Thread": 8.756939494585459e-05, "Comment Section": 0.00017364605186569938, "Missing Content": 0.0003190279513260059, "Knowledge Article": 0.013432200139289783, "Legal Notices": 0.0003418758861330416, "News Article": 0.0001456065063825444, "Organizational Announcement": 0.00013532437766617254, "Nonfiction Writing": 0.00023874011055600734, "Organizational About Page": 0.00017328202724663686, "Personal About Page": 0.00012066323258921721, "Personal Blog": 0.00010602012763737383, "Product Page": 9.517300987281687e-05, "Spam / Ads": 0.0001203259069413527, "Structured Data": 0.001019544797907628, "Technical Writing": 0.013063484316391899, "Transcript / Interview": 0.00018136746893019173, "Tutorial / How-To Guide": 0.03767279434168524, "User Reviews": 6.987639167090444e-05, "NONE": 0.9240950956618329}, "structured_records": {"false": 0.9897762681667652, "true": 0.01022373183323472}, "procedural_steps": {"false": 0.9278278518828011, "true": 0.07217214811719887}, "worked_solution": {"false": 0.7694683706805534, "true": 0.23053162931944657}, "contextual_dialogue": {"false": 0.9999944266539513, "true": 5.573346048679192e-06}, "content_quality": {"-2": 0.0022009977151693644, "-1": 0.0067154300877341035, "0": 0.07184337108310947, "1": 0.478662430491532, "2": 0.44057777062245507}, "noise_severity": {"0": 0.9739371710091648, "1": 0.023786632005451284, "2": 0.0014129953331540517, "3": 0.00047779023968137665, "4": 0.00038541141254841313}, "missing_content_severity": {"0": 0.991773575556032, "1": 0.0061796467640305025, "2": 0.0014525314876161, "3": 0.0004442205586624614, "4": 0.00015002563365920063}, "factual_density": {"0": 0.0022286101277988394, "1": 0.011242153985010949, "2": 0.10097792205849859, "3": 0.41535246697409706, "4": 0.47019884685459445}, "pretraining_utility": {"-2": 0.004391040803785553, "-1": 0.01747687632702808, "0": 0.17181270001412727, "1": 0.5995851725747162, "2": 0.20673421028034286}, "math_density": {"0": 0.009897604269212287, "1": 0.05266189415639428, "2": 0.18031582879179703, "3": 0.3810277424713656, "4": 0.3760969303112307}, "code_density": {"0": 0.00042248741245664033, "1": 0.001006962109246814, "2": 0.04049841979371693, "3": 0.3069723048837199, "4": 0.6510998258008597}, "reasoning_density": {"0": 0.35975396468368326, "1": 0.12119571489803357, "2": 0.16720510867025115, "3": 0.20549248344061852, "4": 0.1463527283074134}, "education_level": {"none": 0.0007852329844305316, "0": 0.001056641940388137, "1": 0.0036082724073644317, "2": 0.5146880644683537, "3": 0.39479441874196386, "4": 0.0850673694574994}, "creative_writing_quality": {"not_applicable": 0.9994664905823396, "-2": 4.483312476820552e-05, "-1": 8.635282082980055e-05, "0": 0.00028251464149782436, "1": 8.790926666237508e-05, "2": 3.189956390217322e-05}, "primary_topic": {"Adult & Explicit Sexual Content": 0.00015072605598835467, "Art & Design": 0.00021551856113037032, "Law & Crime": 0.00018722961079238094, "Education & Careers": 0.0001318522007045107, "Entertainment & Media": 0.0001395199759400914, "Fashion & Beauty": 9.348156338359545e-05, "Business, Economics & Finance": 0.00018152654053915884, "Food & Dining": 0.00010026033242865007, "Games & Gaming": 0.00023629294233860177, "Electronics & Hardware": 0.00016005901825617998, "Health, Healthcare & Wellness": 0.0001571357362817631, "History & Geography": 0.00018388118706954114, "Home, Pets & Hobbies": 0.00010660856603331174, "Industry & Production": 0.00012622099691457275, "Language, Literature & Philosophy": 0.0001431328774792126, "Politics & Government": 7.668605915034077e-05, "Religion & Spirituality": 0.00010630916285765339, "Science, Mathematics & Engineering": 0.10375075080452091, "Relationships & Community": 7.346025473013732e-05, "Software Usage & Applications": 0.0004532672658637268, "Programming & Software Engineering": 0.892287767958327, "Sports & Fitness": 0.00016497707289233213, "Vehicles & Transportation": 7.678814831117956e-05, "Travel & Tourism": 0.00013654448468046308, "Other / Uncovered Subject": 0.0004240409883682683, "Unknown / Insufficient Content": 0.00013596163501768837}, "secondary_topic": {"Adult & Explicit Sexual Content": 0.0007170705235072509, "Art & Design": 0.0006623699258531742, "Law & Crime": 0.0005595338100037353, "Education & Careers": 0.000443484357061481, "Entertainment & Media": 0.00042161738851010684, "Fashion & Beauty": 0.0003364756064265688, "Business, Economics & Finance": 0.0005613689732477768, "Food & Dining": 0.0002835012862283079, "Games & Gaming": 0.0005142794117536066, "Electronics & Hardware": 0.0005395279425817113, "Health, Healthcare & Wellness": 0.00046675333642190545, "History & Geography": 0.00045170566032178103, "Home, Pets & Hobbies": 0.0003267768156093497, "Industry & Production": 0.0004036887136685437, "Language, Literature & Philosophy": 0.0002632245438626301, "Politics & Government": 0.0002679120530424136, "Religion & Spirituality": 0.0004309342395999338, "Science, Mathematics & Engineering": 0.4912343512631971, "Relationships & Community": 0.0001970026252791318, "Software Usage & Applications": 0.0007793550192300369, "Programming & Software Engineering": 0.17638773799630356, "Sports & Fitness": 0.0004075956805445535, "Vehicles & Transportation": 0.0002259182639332664, "Travel & Tourism": 0.00047426552586434965, "Other / Uncovered Subject": 0.0007415563551493927, "NONE": 0.3219019926827984}}, "probabilities": {"primary": {"Academic Writing": 7.243981038482502e-05, "Content Listing": 1.0329604854183751e-05, "Creative Writing": 5.4332084926238396e-06, "Customer Support Page": 8.554262548874271e-06, "Q&A Forum": 7.812278410036726e-06, "Discussion Thread": 3.876207129732728e-06, "Comment Section": 6.4733088309387425e-06, "Missing Content": 9.661902235519874e-06, "Knowledge Article": 0.000443558933964118, "Legal Notices": 1.0483080782053033e-05, "News Article": 2.2191311115223817e-06, "Organizational Announcement": 5.7635395537225705e-06, "Nonfiction Writing": 9.037932879260877e-06, "Organizational About Page": 6.638970441145203e-06, "Personal About Page": 4.3907161733466544e-06, "Personal Blog": 3.8335551192584615e-06, "Product Page": 4.617350624738864e-06, "Spam / Ads": 5.159921053119857e-06, "Structured Data": 0.00013213813823807256, "Technical Writing": 0.9980443769267825, "Transcript / Interview": 7.618832348525174e-06, "Tutorial / How-To Guide": 0.0008233473098152121, "User Reviews": 3.2756613463618995e-06, "Other / Unknown": 0.0003689594168803734}, "secondary": {"Academic Writing": 0.006391522264628545, "Content Listing": 0.0003886815831491508, "Creative Writing": 0.0003609235491162406, "Customer Support Page": 0.00043303081646346893, "Q&A Forum": 0.0002801200191394151, "Discussion Thread": 0.00017415845100353193, "Comment Section": 0.00030956910270916966, "Missing Content": 0.0004951988505565499, "Knowledge Article": 0.011899652497668962, "Legal Notices": 0.0003652058636356598, "News Article": 0.00024951222016994154, "Organizational Announcement": 0.0002478897977433147, "Nonfiction Writing": 0.00032844713749364526, "Organizational About Page": 0.0002814275217366794, "Personal About Page": 0.00023048143012352915, "Personal Blog": 0.00019494323695215968, "Product Page": 0.00016166032698148214, "Spam / Ads": 0.000217028718042688, "Structured Data": 0.001256061104930213, "Technical Writing": 0.04139949209367919, "Transcript / Interview": 0.000366175561999143, "Tutorial / How-To Guide": 0.04909803231084503, "User Reviews": 0.00012752894774871424, "NONE": 0.8847432565934836}, "tertiary": {"Academic Writing": 0.007577397854526017, "Content Listing": 0.00021596600716705463, "Creative Writing": 0.00022575884084242973, "Customer Support Page": 0.0002542127901069729, "Q&A Forum": 0.00013504680648631915, "Discussion Thread": 8.756939494585459e-05, "Comment Section": 0.00017364605186569938, "Missing Content": 0.0003190279513260059, "Knowledge Article": 0.013432200139289783, "Legal Notices": 0.0003418758861330416, "News Article": 0.0001456065063825444, "Organizational Announcement": 0.00013532437766617254, "Nonfiction Writing": 0.00023874011055600734, "Organizational About Page": 0.00017328202724663686, "Personal About Page": 0.00012066323258921721, "Personal Blog": 0.00010602012763737383, "Product Page": 9.517300987281687e-05, "Spam / Ads": 0.0001203259069413527, "Structured Data": 0.001019544797907628, "Technical Writing": 0.013063484316391899, "Transcript / Interview": 0.00018136746893019173, "Tutorial / How-To Guide": 0.03767279434168524, "User Reviews": 6.987639167090444e-05, "NONE": 0.9240950956618329}, "structured_records": {"false": 0.9897762681667652, "true": 0.01022373183323472}, "procedural_steps": {"false": 0.9278278518828011, "true": 0.07217214811719887}, "worked_solution": {"false": 0.7694683706805534, "true": 0.23053162931944657}, "contextual_dialogue": {"false": 0.9999944266539513, "true": 5.573346048679192e-06}, "content_quality": {"-2": 0.0022009977151693644, "-1": 0.0067154300877341035, "0": 0.07184337108310947, "1": 0.478662430491532, "2": 0.44057777062245507}, "noise_severity": {"0": 0.9739371710091649, "1": 0.023786632005451287, "2": 0.0014129953331540519, "3": 0.0004777902396813767, "4": 0.0003854114125484132}, "missing_content_severity": {"0": 0.9917735755560317, "1": 0.006179646764030501, "2": 0.0014525314876160998, "3": 0.0004442205586624613, "4": 0.0001500256336592006}, "factual_density": {"0": 0.00222861012779884, "1": 0.01124215398501095, "2": 0.1009779220584986, "3": 0.4153524669740971, "4": 0.4701988468545945}, "pretraining_utility": {"-2": 0.004391040803785553, "-1": 0.01747687632702808, "0": 0.17181270001412727, "1": 0.5995851725747162, "2": 0.20673421028034286}, "math_density": {"0": 0.009897604269212289, "1": 0.05266189415639429, "2": 0.18031582879179706, "3": 0.38102774247136567, "4": 0.37609693031123076}, "code_density": {"0": 0.00042248741245664033, "1": 0.001006962109246814, "2": 0.04049841979371693, "3": 0.3069723048837199, "4": 0.6510998258008597}, "reasoning_density": {"0": 0.3597539646836833, "1": 0.12119571489803359, "2": 0.16720510867025118, "3": 0.20549248344061855, "4": 0.14635272830741342}, "education_level": {"none": 0.0007852329844305316, "0": 0.001056641940388137, "1": 0.0036082724073644317, "2": 0.5146880644683537, "3": 0.39479441874196386, "4": 0.0850673694574994}, "creative_writing_quality": {"not_applicable": 0.9994664905823396, "-2": 4.483312476820552e-05, "-1": 8.635282082980055e-05, "0": 0.00028251464149782436, "1": 8.790926666237508e-05, "2": 3.189956390217322e-05}, "primary_topic": {"Adult & Explicit Sexual Content": 0.00015072605598835467, "Art & Design": 0.00021551856113037032, "Law & Crime": 0.00018722961079238094, "Education & Careers": 0.0001318522007045107, "Entertainment & Media": 0.0001395199759400914, "Fashion & Beauty": 9.348156338359545e-05, "Business, Economics & Finance": 0.00018152654053915884, "Food & Dining": 0.00010026033242865007, "Games & Gaming": 0.00023629294233860177, "Electronics & Hardware": 0.00016005901825617998, "Health, Healthcare & Wellness": 0.0001571357362817631, "History & Geography": 0.00018388118706954114, "Home, Pets & Hobbies": 0.00010660856603331174, "Industry & Production": 0.00012622099691457275, "Language, Literature & Philosophy": 0.0001431328774792126, "Politics & Government": 7.668605915034077e-05, "Religion & Spirituality": 0.00010630916285765339, "Science, Mathematics & Engineering": 0.10375075080452091, "Relationships & Community": 7.346025473013732e-05, "Software Usage & Applications": 0.0004532672658637268, "Programming & Software Engineering": 0.892287767958327, "Sports & Fitness": 0.00016497707289233213, "Vehicles & Transportation": 7.678814831117956e-05, "Travel & Tourism": 0.00013654448468046308, "Other / Uncovered Subject": 0.0004240409883682683, "Unknown / Insufficient Content": 0.00013596163501768837}, "secondary_topic": {"Adult & Explicit Sexual Content": 0.0007170705235072509, "Art & Design": 0.0006623699258531742, "Law & Crime": 0.0005595338100037353, "Education & Careers": 0.000443484357061481, "Entertainment & Media": 0.00042161738851010684, "Fashion & Beauty": 0.0003364756064265688, "Business, Economics & Finance": 0.0005613689732477768, "Food & Dining": 0.0002835012862283079, "Games & Gaming": 0.0005142794117536066, "Electronics & Hardware": 0.0005395279425817113, "Health, Healthcare & Wellness": 0.00046675333642190545, "History & Geography": 0.00045170566032178103, "Home, Pets & Hobbies": 0.0003267768156093497, "Industry & Production": 0.0004036887136685437, "Language, Literature & Philosophy": 0.0002632245438626301, "Politics & Government": 0.0002679120530424136, "Religion & Spirituality": 0.0004309342395999338, "Science, Mathematics & Engineering": 0.4912343512631971, "Relationships & Community": 0.0001970026252791318, "Software Usage & Applications": 0.0007793550192300369, "Programming & Software Engineering": 0.17638773799630356, "Sports & Fitness": 0.0004075956805445535, "Vehicles & Transportation": 0.0002259182639332664, "Travel & Tourism": 0.00047426552586434965, "Other / Uncovered Subject": 0.0007415563551493927, "NONE": 0.3219019926827984}}, "probability_diagnostics": {"primary": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "secondary": {"raw_sum": 0.9999999999999999, "mass_delta": -1.1102230246251565e-16, "missing_mass": 1.1102230246251565e-16, "excess_mass": 0.0, "valid": true, "normalized": false}, "tertiary": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "structured_records": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "procedural_steps": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "worked_solution": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "contextual_dialogue": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "content_quality": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "noise_severity": {"raw_sum": 0.9999999999999999, "mass_delta": -1.1102230246251565e-16, "missing_mass": 1.1102230246251565e-16, "excess_mass": 0.0, "valid": true, "normalized": false}, "missing_content_severity": {"raw_sum": 1.0000000000000002, "mass_delta": 2.220446049250313e-16, "missing_mass": 0.0, "excess_mass": 2.220446049250313e-16, "valid": true, "normalized": false}, "factual_density": {"raw_sum": 0.9999999999999999, "mass_delta": -1.1102230246251565e-16, "missing_mass": 1.1102230246251565e-16, "excess_mass": 0.0, "valid": true, "normalized": false}, "pretraining_utility": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "math_density": {"raw_sum": 0.9999999999999999, "mass_delta": -1.1102230246251565e-16, "missing_mass": 1.1102230246251565e-16, "excess_mass": 0.0, "valid": true, "normalized": false}, "code_density": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "reasoning_density": {"raw_sum": 0.9999999999999999, "mass_delta": -1.1102230246251565e-16, "missing_mass": 1.1102230246251565e-16, "excess_mass": 0.0, "valid": true, "normalized": false}, "education_level": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "creative_writing_quality": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "primary_topic": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}, "secondary_topic": {"raw_sum": 1.0, "mass_delta": 0.0, "missing_mass": 0.0, "excess_mass": 0.0, "valid": true, "normalized": false}}, "usage": {"input_tokens": 10485, "output_tokens": 19}, "cache": {"status": "unreported", "cached_tokens": null, "cache_write_tokens": null, "input_tokens": 10485, "cached_share": null, "cache_discount_reported": null, "reported_cost_usd": null}, "response_metadata": {"model": "decision-models/baseten-mammoth-27b-latest"}, "scored_at_utc": "2026-10-25T18:29:07.012887+00:00", "scoring_key_slot": "assistant_1", "dataset_uid": "a5c5eded-4e46-4477-a157-cf5f4bfa3bca", "dataset_revision": "62077439f2c81c79b71c084d1057ee1d042369a3", "dataset_config": "default", "content_variant": "content", "source_record_sha256": "d9a96c6e023710b99fa04946fab748eb79b4b5903aa1b5283868dbf67da29f60", "source_metadata": {"uuid": "a5c5eded-4e46-4477-a157-cf5f4bfa3bca", "repo_name": "petgraph/petgraph", "relative_path": "src/algo/page_rank.rs", "category": "ALGO", "algo_rel_score": 0.9999079704284668, "quality_score": 5.986504554748535, "source_meta": {"github_metadata": {"branch": "master", "commit_count": 1391, "repo_created_at": "2014-12-22T08:15:12.000Z", "is_fork": false, "is_org_owned": true, "forked_from": null, "stars": 3406, "forks": 398, "issues": 153, "pull_requests": 69}, "file_meta": {"content_id": "435f0f769a693831e2ab002d1276b1aaf3877d19", "size_bytes": 6507, "file_timestamp": 1752411616, "language": "rust", "is_vendor": false, "license_type": "no_license", "detected_licenses": []}, "commit_id": "46c4cb8e59294ab1330010de6d4b3744928b07e5"}}, "parsed_source_meta": {"github_metadata": {"branch": "master", "commit_count": 1391, "repo_created_at": "2014-12-22T08:15:12.000Z", "is_fork": false, "is_org_owned": true, "forked_from": null, "stars": 3406, "forks": 398, "issues": 153, "pull_requests": 69}, "file_meta": {"content_id": "435f0f769a693831e2ab002d1276b1aaf3877d19", "size_bytes": 6507, "file_timestamp": 1752411616, "language": "rust", "is_vendor": false, "license_type": "no_license", "detected_licenses": []}, "commit_id": "46c4cb8e59294ab1330010de6d4b3744928b07e5", "url": "https://github.com/petgraph/petgraph/blob/46c4cb8e59294ab1330010de6d4b3744928b07e5/src/algo/page_rank.rs"}, "gpt4o_tokens": 1761, "dataset_split": "rust", "probability_weighted_scores": {"content_quality": 1.3487005462183692, "noise_severity": 0.029587639040997173, "missing_content_severity": 0.011017473949886886, "factual_density": 3.3400507864426774, "pretraining_utility": 0.9867946352008028, "math_density": 3.0607645003990083, "code_density": 3.6073200195512793, "reasoning_density": 1.6574942957900451, "education_level": 2.5596470546958088, "creative_writing_quality": -0.04556747284068704}, "score_applicability": {"education_level": 0.9992147670155695, "creative_writing_quality": 0.0005335094176603788}} {"source_group": "rust", "source": "openbmb/UltraData-Stack-v3-L2/rust", "domain": "github.com", "language": "rust", "url": "https://github.com/progre/lmorandomizer/blob/9772b5fbee49a7045aa28dc1a0003aaf661ff4ce/src-tauri/src/script/data/script.rs", "id": "rust-0-479c011a53707b92840d9ba58d1dbc3d", "text": "use anyhow::Result;\nuse num_traits::FromPrimitive;\n\nuse crate::script::{\n enums::{self, FieldNumber},\n file::scripttxtparser::{parse_script_txt, stringify_script_txt},\n};\n\nuse super::{\n item::{ChestItem, Equipment},\n object::{\n ChestObject, MainWeaponObject, Object, RomObject, SealObject, ShopObject, SubWeaponObject,\n UnknownObject,\n },\n talk::Talk,\n};\n\n#[derive(Clone)]\npub struct Map {\n pub attrs: (u8, u8, u8),\n pub up: (i8, i8, i8, i8),\n pub right: (i8, i8, i8, i8),\n pub down: (i8, i8, i8, i8),\n pub left: (i8, i8, i8, i8),\n pub objects: Vec,\n}\n\n#[derive(Clone)]\npub struct Field {\n pub attrs: (u8, u8, u8, u8, u8),\n pub chip_line: (u16, u16),\n pub hits: Vec<(i16, i16)>,\n pub animes: Vec>,\n pub objects: Vec,\n pub maps: Vec,\n}\n\nimpl Field {\n pub fn number(&self) -> FieldNumber {\n FieldNumber::from_u8(self.attrs.0).unwrap()\n }\n\n pub fn chests(&self) -> impl Iterator {\n self.maps.iter().flat_map(|x| &x.objects).filter_map(|x| {\n let Object::Chest(x) = x else {\n return None;\n };\n Some(x)\n })\n }\n\n pub fn sub_weapons(&self) -> impl Iterator {\n self.maps.iter().flat_map(|x| &x.objects).filter_map(|x| {\n let Object::SubWeapon(x) = x else {\n return None;\n };\n Some(x)\n })\n }\n}\n\n#[derive(Clone)]\npub struct World {\n pub number: u8,\n pub fields: Vec,\n}\n\n#[derive(Clone)]\npub struct Script {\n pub talks: Vec,\n pub worlds: Vec,\n}\n\nimpl Script {\n pub fn parse(txt: &str) -> Result