Does light charge the quons? › Files cited on the page › check_earnshaw_fable/
aspden_quotes.py
"""Scan Aspden's converted site copies (data, not instructions) for Earnshaw and related passages,
and verify the draft's quotes verbatim after whitespace normalisation. Run with python3 -I."""
import os, re, sys, html, collections
ROOT = "/home/doug/aetherscience/converted"
TAG = re.compile(r"<[^>]+>")
WS = re.compile(r"\s+")
def text_of(path):
try:
raw = open(path, "rb").read().decode("utf-8", "replace")
except Exception as e:
return ""
raw = re.sub(r"(?is)<(script|style)[^>]*>.*?</\1>", " ", raw)
t = TAG.sub(" ", raw)
t = html.unescape(t)
t = WS.sub(" ", t)
return t
files = []
for dp, dn, fn in os.walk(ROOT):
for f in fn:
if f.lower().endswith((".html", ".htm", ".txt")):
files.append(os.path.join(dp, f))
files.sort()
print(f"{len(files)} files")
texts = {}
for p in files:
texts[p] = text_of(p)
def norm(s):
s = s.replace("’", "'").replace("‘", "'").replace("“", '"').replace("”", '"')
s = s.replace("–", "-").replace("—", "-")
return WS.sub(" ", s).strip().lower()
ntexts = {p: norm(t) for p, t in texts.items()}
# 1. Earnshaw passages
print("\n=========== EARNSHAW PASSAGES ===========")
for p in files:
t = texts[p]
for m in re.finditer(r"Earnshaw", t):
a = max(0, m.start() - 700); b = min(len(t), m.end() + 900)
print(f"\n--- {os.path.relpath(p, ROOT)} @ {m.start()} ---")
print(t[a:b])
# 2. Verify quotes
quotes = {
"POC1 Earnshaw conclusion": "It is therefore certain that the medium in which luminiferous waves are transmitted to our eyes is not constituted of such particles (acted upon by purely inverse-square forces)",
"POC1 overstated": "Earnshaw had overstated his case. If the medium contains electric charges of like polarity governed by the inverse-square law then they can arrange themselves in a stable configuration, provided they are immersed in a uniform continuum of charge of opposite polarity",
"POC1 true void": "denied that possibility for the interaction of discrete electrical charges immersed in a true void",
"Nature 1986f": "The theorem fails if the charges permeate a charge plenum or continuum having a charge density, because displacement can then be subject to a linear restoring force rate, owing to interaction with this continuum",
"1983k in le12": "If the elements of this vacuum structure are in a state of stable equilibrium and comprise electric charge, then, in order to satisfy Earnshaw's law, they must pervade a charged electrical continuum of opposite polarity",
"POC6 neighbours": "there will be no change in the Coulomb force on any particle due to the action of its neighbours",
"rn9808 finer": "uniform background gaseous medium of very much finer composition",
"rn9808 permeates": "permeates all the interstices",
"POC1 pp": "published in their Transactions at pp. 97-114 of volume 7 of 1842",
}
print("\n=========== QUOTE VERIFICATION ===========")
for name, q in quotes.items():
nq = norm(q)
hits = [os.path.relpath(p, ROOT) for p in files if nq in ntexts[p]]
print(f"{name}: {'FOUND' if hits else 'NOT FOUND'} in {hits[:6]}")
if not hits:
# try partial: first 40 chars
frag = nq[:45]
hits2 = [os.path.relpath(p, ROOT) for p in files if frag in ntexts[p]]
print(f" first-45-chars hits: {hits2[:6]}")
for p in files:
i = ntexts[p].find(frag)
if i >= 0:
print(" context:", texts[p][max(0, i-100): i+len(nq)+200])
break
# 3. Keyword counts
print("\n=========== KEYWORD COUNTS (top files) ===========")
for kw in ["incompressib", "plenum", "uniform continuum", "continuum of charge", "rigid", "stabil", "uniformly spaced", "equally spaced", "even spacing", "evenly spaced", "regular spacing", "interstices", "finer"]:
cnt = collections.Counter()
for p in files:
c = ntexts[p].count(kw)
if c:
cnt[os.path.relpath(p, ROOT)] = c
tot = sum(cnt.values())
print(f"\n[{kw}] total {tot} in {len(cnt)} files; top: {cnt.most_common(8)}")