You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implementation is easy via facet type "tag"
In parse_facets() add
for t in parse_tags(text):
facets.append(
{
"index": {
"byteStart": t["start"],
"byteEnd": t["end"],
},
"features": [
{
"$type": "app.bsky.richtext.facet#tag",
"tag": t["tag"],
}
],
}
)
Implementation is easy via facet type "tag"
In parse_facets() add
for t in parse_tags(text):
facets.append(
{
"index": {
"byteStart": t["start"],
"byteEnd": t["end"],
},
"features": [
{
"$type": "app.bsky.richtext.facet#tag",
"tag": t["tag"],
}
],
}
)
add method parse_tags()
def parse_tags(text: str) -> List[Dict]:
spans = []
url_regex = rb"(?:\s|^)(?:#(?!(?:\d+|\w+?|\w*?)(?:\s|$)))(\w+)(?=\s|$)"
text_bytes = text.encode("UTF-8")
for m in re.finditer(url_regex, text_bytes):
spans.append(
{
"start": m.start(1),
"end": m.end(1),
"tag": m.group(1).decode("UTF-8"),
}
)
return spans
The text was updated successfully, but these errors were encountered: