Hanaz Writers

Story Name Provider

function extractKeywords(text) { // Keyword extraction logic const commonWords = new Set(['the', 'and', 'of', 'in', 'a', 'to', 'is', 'that', 'with', 'it', 'as', 'for', 'was', 'on', 'at', 'by', 'an', 'this', 'which']); const words = text.toLowerCase().split(/[^a-zA-Z]+/); const wordCounts = {}; words.forEach(word => { if (word.length > 3 && !commonWords.has(word)) { wordCounts[word] = (wordCounts[word] || 0) + 1; } }); const sortedKeywords = Object.entries(wordCounts) .sort((a, b) => b[1] - a[1]) .slice(0, 5) // Top 5 keywords .map(entry => entry[0]); return sortedKeywords; } function generateDynamicTitle(keyword1, keyword2) { const structures = [ `The ${keyword1} and the ${keyword2}`, `Chronicles of ${keyword1} and ${keyword2}`, `The Rise of ${keyword1}`, `${keyword1}: A Tale of ${keyword2}`, `In the Shadow of ${keyword1}`, `${keyword1} and the Secrets of ${keyword2}`, `The Legacy of ${keyword1}`, `${keyword2}: The ${keyword1} Prophecy` ]; return structures[Math.floor(Math.random() * structures.length)]; } function generateStoryNames() { const manuscriptText = document.getElementById('manuscriptText').value.trim(); const loadingMessage = document.getElementById('loadingMessage'); const errorMessage = document.getElementById('errorMessage'); const storyNameOutput = document.getElementById('storyNameOutput'); const storyNameList = document.getElementById('storyNameList'); // Clear previous messages and outputs errorMessage.style.display = 'none'; storyNameOutput.style.display = 'none'; storyNameList.innerHTML = ''; if (!manuscriptText) { errorMessage.textContent = 'Please enter your manuscript text.'; errorMessage.style.display = 'block'; return; } // Display loading message loadingMessage.style.display = 'block'; setTimeout(() => { try { // Extract keywords from the manuscript const keywords = extractKeywords(manuscriptText); if (keywords.length === 0) { throw new Error('No significant keywords found.'); } // Generate multiple meaningful story names based on the top keywords const storyNames = []; for (let i = 0; i < keywords.length - 1; i++) { for (let j = i + 1; j { const listItem = document.createElement('li'); listItem.textContent = name; storyNameList.appendChild(listItem); }); storyNameOutput.style.display = 'block'; loadingMessage.style.display = 'none'; } catch (error) { loadingMessage.style.display = 'none'; errorMessage.textContent = 'Failed to generate story names. Please ensure your text has meaningful content.'; errorMessage.style.display = 'block'; } }, 1000); // Simulate processing delay }

AI Hanaz Writers version 1.0 is currently available. Version 2.0, a more advanced and purchasable upgrade, is currently being designed and prepared.