sanguineCyanMastodonREADME.md11 matches
22stopwords: Contains a list of common stop words and web-specific terms to filter out during text analysis.
23synonyms: Dictionary mapping common words to their synonyms for highlighting in TF-IDF analysis.
24Functions
25The primary functions perform specific text analysis tasks, as detailed in the following sections.
2627Function Documentation
28Each function's purpose, parameters, and output are described below, along with notes on how they are used within the application.
2930analyseSentiment(text)
7273url (string): URL to fetch and clean content from. Returns: Cleaned text string or an error message.
74Usage: This function powers the URL input functionality.
75Core Functionalities
76Text Analysis Form (HTML)
77The form on the main page allows users to submit either raw text or a URL. The client-side JavaScript processes the form submission and, if needed, triggers a URL fetch to obtain content.
9192Integration Tests: Ensure calculateTFIDF, calculateWordFrequency, and fetchUrlContent produce consistent outputs.
93Client-Side Testing: Regularly test URL fetching functionality to ensure robustness, particularly with dynamic sites.
94Error Handling
9596Maintain try/catch blocks in asynchronous functions like fetchUrlContent to capture network issues.
97Update error messages to be user-friendly and provide feedback if inputs are invalid or exceed size limits.
98Data Sanitization
115Multilingual Support
116117Extend stop words, sentiment analysis, and cleaning functions to support languages beyond English.
118119The Radical Text Analyser code primarily uses the following APIs:
1232. External Content Fetching API (via fetch)
124* Purpose: Retrieves HTML content from external URLs when users input a URL for analysis.
125* Usage: The fetchUrlContent function uses fetch to make a GET request to the user-provided URL, which allows the application to process content from web pages.
126* Error Handling: Includes logic to check response status and handle various network errors.
1273. Google Fonts API
132* Usage: Loaded in the HTML <head> section with <script src="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud-1.0.4.min.js"></script> and <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jqcloud/1.0.4/jqcloud.min.css">
133134The TF-IDF analysis in this code is performed without using an external library. Instead, it’s implemented directly in the `calculateTFIDF` function. Here’s how it works:
1351361. **Tokenization and Filtering**: The text is split into words and phrases, excluding stopwords and web-specific terms.
twitterAlertmain.tsx1 match
4const query = "\"samwho.dev\" -is:retweet -from:samwhoo";
56export async function twitterAlert({ lastRunAt }: Interval) {
7// search
8const since = lastRunAt ? Math.floor(lastRunAt.getTime() / 1000) : 0;
scraper_templateREADME.md1 match
133. Adjust the if statement to detect changes and update your blob
14154. Craft a message to be sent with `sendNotification()` function
diplomaticMagentaMothmain.tsx3 matches
6const SNAKE_SPEED = 100;
78function App() {
9const canvasRef = useRef(null);
10const [score, setScore] = useState(0);
189}
190191function client() {
192createRoot(document.getElementById("root")).render(<App />);
193}
195if (typeof document !== "undefined") { client(); }
196197export default async function server(request: Request): Promise<Response> {
198return new Response(`
199<html>
labLoginUpdateStatusmain.tsx1 match
3import { sqlite } from "https://esm.town/v/std/sqlite";
45export default async function(req: Request): Promise<Response> {
6const TABLE_NAME = "lab_login_users_with_times";
7const body = await req.json();
3import { sqlite } from "https://esm.town/v/std/sqlite";
45export default async function(req: Request): Promise<Response> {
6const body = await req.json();
7let { username, password } = body;
10import { basicAuth } from "https://esm.town/v/pomdtr/basicAuth";
1112function handler(req: Request) {
13return new Response("You are authenticated!");
14}
23import { verifyToken } from "https://www.val.town/v/pomdtr/verifyToken"
2425function handler(req: Request) {
26return new Response("You are authenticated!");
27}
1function extractCredentials(authorization) {
2const parts = authorization.split(" ");
3if (parts[0] != "Basic") {
11export type ServeHandler = (req: Request) => Response | Promise<Response>
1213export function basicAuth(next: ServeHandler, params: {
14verifyUser: (username: string, password: string) => boolean | Promise<boolean>;
15}): ServeHandler {
8}
910export default async function server(request: Request): Promise<Response> {
11const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
12const KEY = "delightfulVioletAntlion";
3import { createRoot } from "https://esm.sh/react-dom/client";
45function StarRating({ rating, onRate }) {
6return (
7<div>
19}
2021function DetailView({ item, type, onClose }) {
22const [comments, setComments] = useState([]);
23const [newComment, setNewComment] = useState('');
93}
9495function App() {
96const [page, setPage] = useState("clinics");
97const [search, setSearch] = useState("");
288}
289290function client() {
291createRoot(document.getElementById("root")).render(<App />);
292}
293if (typeof document !== "undefined") { client(); }
294295export default async function server(request: Request): Promise<Response> {
296const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
297const SCHEMA_VERSION = 4