SaSS-ify with Jigsaw Stack – DEV Community

SaSS-ify with Jigsaw Stack – DEV Community


Jigsaw Stack’s API provides various services, such as web scraping and LLM prompting. I tried out the web scraping and translation services in a fit of vanity. Wired Japan interviewed me, and I wanted to try Jigsaw Stack’s translation service. You can sign up for Jigsaw Stack and create a token to access the services for free. Here’s example code to scrape the part of the article about me and translate it from Japan to English.

from jigsawstack import JigsawStack, JigsawStackError as err
import os, re
from dotenv import load_dotenv

load_dotenv()

api_key = os.getenv("JIGSAW_STACK_API_KEY")
jss = JigsawStack(api_key)

# scrape the page
result =  jss.web.ai_scrape({
  "url": "https://wired.jp/2013/10/21/code-for-america/",
  "element_prompts": ["Sophia Parafina"],
});

data = result["data"]
content = []
a=re.compile("<.*?>")

# extract and clean up any tags
for d in data:
    text = d["results"][0]["html"]
    text = a.sub("", text)
    content.append(text)

print("\n".join(content))

# translate the text
result = jss.translate({ 'text': "\n".join(content), 'target_language':"en", 'current_language':"ja" });

print(result["translated_text"])
Enter fullscreen mode

Exit fullscreen mode

The Python packages jigsawstack and dotenv are required to run the script.

The web scraper returned the Japanese text.

ソフィア・パラフィナ |Sophia ParafinaGISソフトウェア開発者、経営者、ITコンサルタント。CfAのフェローとしては最年長のひとり。政府系VCで軍事諜報関連ビジネスを手がけてきたほか、GISソフトの会社を設立・売却してきた歴戦の強者だ。今後、政府と働くことは?の問いには「イノヴェイトし続けられる仕事であれば」と答える。カルフォルニア州サンマテオ郡政府と協働中。
ソフィア・パラフィナ |Sophia ParafinaGISソフトウェア開発者、経営者、ITコンサルタント。CfAのフェローとしては最年長のひとり。政府系VCで軍事諜報関連ビジネスを手がけてきたほか、GISソフトの会社を設立・売却してきた歴戦の強者だ。今後、政府と働くことは?の問いには「イノヴェイトし続けられる仕事であれば」と答える。カルフォルニア州サンマテオ郡政府と協働中。
ソフィアとサンマテオ郡の場合
ソフィア・パラフィナ |Sophia ParafinaGISソフトウェア開発者、経営者、ITコンサルタント。CfAのフェローとしては最年長のひとり。政府系VCで軍事諜報関連ビジネスを手がけてきたほか、GISソフトの会社を設立・売却してきた歴戦の強者だ。今後、政府と働くことは?の問いには「イノヴェイトし続けられる仕事であれば」と答える。カルフォルニア州サンマテオ郡政府と協働中。
ソフィアは、現在行っているサーヴィスをオープンソースで制作している。かつて行政は、マイクロソフトやオラクルといった大企業と組んで大規模な開発を行ってきたが、オープンソース化が一層進み、小回りの利くスピーディな開発が一般化することで行政機構に大きな変化がおこるとソフィアは言う。
Enter fullscreen mode

Exit fullscreen mode

This is the translation.

Sophia Parafina | GIS software developer, entrepreneur, IT consultant. One of the oldest fellows at CfA. She has been involved in military intelligence-related businesses with a government-affiliated VC and is a seasoned veteran who has founded and sold a GIS software company. When asked about working with the government in the future, she responds, "If it's a job that allows for continuous innovation." Currently collaborating with the San Mateo County government in California. 

In the case of Sophia and San Mateo County, Sophia Parafina | GIS software developer, entrepreneur, IT consultant. One of the oldest fellows at CfA. She has been involved in military intelligence-related businesses with a government-affiliated VC and is a seasoned veteran who has founded and sold a GIS software company. When asked about working with the government in the future, she responds, "If it's a job that allows for continuous innovation." Currently collaborating with the San Mateo County government in California. 

Sophia is currently producing services as open source. In the past, the administration partnered with large companies like Microsoft and Oracle for large-scale development, but Sophia believes that as open source becomes more prevalent and agile, speedy development becomes the norm, significant changes will occur in the administrative structure.
Enter fullscreen mode

Exit fullscreen mode

This was a quick and easy way to scrape and translate a site without having to install packages such as requests, beautifulsoup, or googletrans and write code. What else can you do with Jigsaw Stack? Check out a proof-of-concept RAG app for converting YouTube videos into a chatbot.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *