So I'm trying to go in and clean up some of my ebooks because I have some in my digital library that have various things that really annoy me, page headers and such with my name and email, page numbers stuck in the middle of paragraphs, things like that

I've got calibre downloaded and can get into the actual HTML of the ebooks and make edits but my GOD it's slow and tedious to do it manually

There HAS to be a way to automate this somehow, right? Some kind of script where I can say "Find every instance of this string and delete it" right?

I'm sure I would have to download some sort of scripting language but like

That's fine

Look how annoying this shit is tho

Why would you hardcode page numbers in an ebook

This is the type of shit we SHOULD be working on when it comes to various forms of computer automation and natural language processing tbh

Calibre does have a regex parser in its HTML search but I do NOT understand regex at all

@wallhackio @coriander i like regex but i would never use it for HTML

@Lady @coriander I used it for HTML in the evil source code that powers my blog :clodsire_head:​:clodsire_tail:​

@wallhackio @coriander you doofus, HTML requires a Type-2 Chomsky grammar and a regex is only Type-3

@wallhackio @coriander Chomsky is a guy that coriander hates that did some things in linguistics and also computers

@Lady @coriander I KNOW WHO CHOMSKY IS i just don't know what the hell type-2 and type-3 chonky grammers are

@wallhackio @coriander chomsky's grammar hierarchy is (3) regular (i.e. regular expressions), (2) context-free, (1) context-sensitive, (0) recursively enumerable

(3) and (2) are the only ones which actually matter because once you hit context-sensitive you have to grapple with the halting problem

the difference between them is regular grammars cannot ensure that every open parenthesis (quote, tag, etc) has a matching closing one, whereas a CFG can

@Lady @wallhackio @coriander a very nice purropurrty of context free grammars is that they can be parsed in linear time

Follow

@aescling @wallhackio @coriander i think you mean regular grammars? wikipedia gives the lowest known upper bound for complexity of a CFG as O(n^2.3728596)

@Lady @wallhackio @coriander oh i’m wrong it’s certain subsets of CFGs that can be parsed in linear time

@aescling @Lady @wallhackio @coriander Certain subsets can even be parsed in constant time, and yet...

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.