API References
Functions
clean_syntax(content)
This function is used to clean the syntax of the content (for Wikipedia markup only).
from grimm import clean_syntax
text, external_links, internal_links, images = clean_syntax(content)
Parameters
Name | Type | Description |
---|---|---|
content | str | The content to clean. |
Returns
This function will return a tuple of four items.
Name | Type | Description |
---|---|---|
text | str | The cleaned text. |
external_links | list[[int, int, any]] | The external links in the text. |
internal_links | list[[int, int, any]] | The internal links in the text. |
images | list[[int, int, any]] | The links of images in the text. |
For external_links
, internal_links
, and images
, the third item in the tuple is the link itself (generally string). The first two items in the tuple are the start index (inclusive) and end index (exclusive) of the link in the text.
Last updated on December 7, 2022