-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhyper.py
More file actions
27 lines (25 loc) · 774 Bytes
/
hyper.py
File metadata and controls
27 lines (25 loc) · 774 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from template import list_link_templ, span_templ
def enrich_value(stemmer: str, vocab: str, word: str, stem: str, found: int = 0) -> str:
title = f"{stem} ({found})" if found else f"{stem} (not found)"
styled = (
span_templ.format(
id=stem + "-tag",
type=f"{stemmer} {stem}", # if i == 0 else stemmer,
title=title,
content=stem,
)
+ word[len(stem) :]
+ (f" ({found})" if found else "")
)
linked = (
list_link_templ.format(
id=stem + "-link",
url=f"/{stemmer}/{vocab}/values/{stem}.html",
type=f"{stemmer}",
title=title,
content=styled,
)
if found
else styled
)
return linked