This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

limit word count

+7 -23
+7 -23
src/wolf-noise-generator.ts
··· 47 47 const randomWords = wolfNoises[category]; // Get words for the selected category 48 48 49 49 let result = ""; 50 - let currentSentenceLength = 0; 51 - 52 - // Determine whether to generate a shorter post, longer post, or very short post 53 - const shorterPostProbability = 0.7; // 70% chance of generating a shorter or very short post 54 - const generateShorterOrVeryShortPost = Math.random() < shorterPostProbability; 55 50 let maxLength; 56 51 57 - if (generateShorterOrVeryShortPost) { 58 - // Determine whether to generate a very short post (1-5 words) or a shorter post (up to 140 or 280 characters) 59 - const veryShortPostProbability = 0.3; // 30% chance of generating a very short post 60 - const generateVeryShortPost = Math.random() < veryShortPostProbability; 61 - 62 - if (generateVeryShortPost) { 63 - // Generate a very short post (1-5 words) 64 - const wordCount = getRandomInt(1, 5); 65 - maxLength = wordCount * 10; // Assuming an average word length of 10 characters 66 - } else { 67 - // Generate a shorter post (up to 140 or 280 characters) 68 - maxLength = getRandomInt(70, 140); // For shorter post 69 - // maxLength = getRandomInt(140, 280); // For longer post 70 - } 52 + if (category === "howl") { 53 + // For howl, limit to 1 word only 54 + maxLength = 10; // Assuming an average word length of 10 characters 71 55 } else { 72 - // Generate a longer post (up to 280 characters) 73 - maxLength = 280; 56 + // For other categories, limit to 3-9 words 57 + const wordCount = getRandomInt(3, 9); 58 + maxLength = wordCount * 10; // Assuming an average word length of 10 characters 74 59 } 75 60 76 61 while (result.length < maxLength) { ··· 84 69 result += " "; 85 70 } 86 71 result += randomWord; 87 - currentSentenceLength += wordLength; 88 72 } else { 89 73 // Break the loop if adding the word would exceed the maximum length 90 74 break; ··· 104 88 } 105 89 106 90 return result.trim(); // Remove any leading/trailing whitespace 107 - } 91 + }