mirror of
https://github.com/tcsenpai/easy-web-summarizer.git
synced 2025-06-07 02:55:20 +00:00
Refactor code to improve readability and maintainability
This commit is contained in:
parent
d9de8deab6
commit
a45c7c9e09
@ -57,8 +57,6 @@ def main():
|
|||||||
llm_chain = setup_summarization_chain()
|
llm_chain = setup_summarization_chain()
|
||||||
result = llm_chain.run(docs)
|
result = llm_chain.run(docs)
|
||||||
|
|
||||||
print(result)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
@ -8,6 +8,7 @@ from langchain_core.prompts import PromptTemplate
|
|||||||
|
|
||||||
|
|
||||||
def check_link(link):
|
def check_link(link):
|
||||||
|
"""The function `check_link` uses a regular expression to check if a given link is a valid YouTube video link."""
|
||||||
yt_regex = r"^(?:https?:\/\/)?(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]+)(?:\?.*)?$"
|
yt_regex = r"^(?:https?:\/\/)?(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]+)(?:\?.*)?$"
|
||||||
return re.match(yt_regex, link) is not None
|
return re.match(yt_regex, link) is not None
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user