update @ Thu Jul 11 04:41:40 EEST 2024

Signed-off-by: Ari Archer <ari@ari.lt>
This commit is contained in:
Arija A. 2024-07-11 04:41:40 +03:00
parent 2abdc6d73d
commit 05d2ca3089
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: A50D5B4B599AF8A2

View file

@ -959,6 +959,9 @@ def build(config: dict[str, typing.Any]) -> int:
pd: Counter[int] = Counter() pd: Counter[int] = Counter()
ph: Counter[int] = Counter() ph: Counter[int] = Counter()
w_regex: re.Pattern[str] = re.compile(r"\b[a-zA-Z']+\b")
url_regex: re.Pattern[str] = re.compile(r"https?://\S+|www\.\S+")
def build_post(slug: str, post: dict[str, typing.Any]) -> None: def build_post(slug: str, post: dict[str, typing.Any]) -> None:
ct: float = ctimer() ct: float = ctimer()
@ -966,11 +969,11 @@ def build(config: dict[str, typing.Any]) -> int:
os.makedirs(post_dir) os.makedirs(post_dir)
rtm: MarkdownResult = read_time_of_markdown(post["content"], config["read-wpm"]) rtm: MarkdownResult = read_time_of_markdown(post["content"], config["read-wpm"])
cont: str = post["content"] + " " + post["title"] cont: str = url_regex.sub("", post["content"]) + " " + post["title"]
rt.append(rtm.seconds) rt.append(rtm.seconds)
cc.append(len(cont)) cc.append(len(cont))
ws.update(Counter(cont.lower().split())) ws.update(Counter(w_regex.findall(cont.lower().strip())))
tgs.update(Counter(list(map(str.lower, post["keywords"])))) tgs.update(Counter(list(map(str.lower, post["keywords"]))))
dt, s = rf_format_time(post["created"]) dt, s = rf_format_time(post["created"])