#!/usr/bin/env python3 """The Oracle7 kernel, v7: META SWARM round 2, the second-largest hole class (numbers_unread, 7.5% of the census). Sampled from the pools, the unread numbers were three classes, each fixed in the READER (so the kernel AND the faces it learns from the specialists' own examples both read them): 1. number formatting: "2.5 * (10)^(4)", "5 . 0*( 10 )^(5)", "34 . 0º C", "45º" -> ordinary numbers and units; 2. a number after a quantity noun the formula parts declare DIMENSIONLESS ("refractive index of 1.52", "f-number of 16", "efficiency of 0.35") -> that quantity, dimensionless, named by its noun (role); 3. a count: a number before a plural noun or "-tooth"/"-turn" style compound ("2 supporting strands", "18-tooth", "500 bacteria") -> a dimensionless count named by its noun (role "count:"). A named dimensionless quantity or count is never a FREE factor of core arithmetic (the 09-30 law: hidden dimensionless factors make dimensional analysis a weak filter); only a part whose slot reads it may use it. usage: module (Kernel7, a drop-in for Kernel6)""" from __future__ import annotations import re import sys from kernel_v6 import Kernel6 import kernel_v5 reader = kernel_v5.reader G1 = sys.modules["glue1_v3"] G2 = sys.modules["glue2_v3"] _orig_norm, _orig_givens = reader.normalise, reader.read_givens SCI = [(re.compile(r"(\d)\s*\.\s*(\d)"), r"\1.\2"), # "5 . 0" -> "5.0" (re.compile(r"(-?\d[\d.]*)\s*[*x×]\s*\(?\s*10\s*\)?\s*\^\s*\(?\s*(-?\d+)\s*\)?"), r"\1e\2"), # 2.5 * (10)^(4) (re.compile(r"º"), "°"), (re.compile(r"(\d)\s*°\s*([CF])\b"), r"\1 \2")] COUNT = re.compile(r"(?