Does light charge the quons? › Files cited on the page › check_lattices_fable/
sign_grep.py
import html, re, sys
from pypdf import PdfReader
def clean(s):
s = re.sub(r"<script.*?</script>|<style.*?</style>", " ", s, flags=re.S); s = re.sub(r"<[^>]+>", " ", s); return re.sub(r"\s+", " ", html.unescape(s))
t = clean(open(sys.argv[1], encoding="utf-8", errors="replace").read())
print("POC ch. 1 (site copy): passages with 'negative' or 'positive' near charge words")
for m in re.finditer(r"(negative|positive)", t):
a = t[max(0, m.start()-150): m.end()+150]
if re.search(r"continuum|quon|lattice|particle", a, re.I): print(" ...", a, "...")
r = PdfReader(sys.argv[2]); t2 = re.sub(r"\s+", " ", " ".join((p.extract_text() or "") for p in r.pages))
print("\nPOC ch. 9 PDF:", len(t2), "chars")
for m in re.finditer(r"(negative|positive)", t2):
a = t2[max(0, m.start()-150): m.end()+150]
if re.search(r"continuum|quon|lattice", a, re.I): print(" ...", a, "...")