{"id":114,"date":"2026-11-19T07:00:41","date_gmt":"2026-11-19T07:00:41","guid":{"rendered":"http:\/\/localhost\/wordpress\/?page_id=114"},"modified":"2026-11-19T07:00:41","modified_gmt":"2026-11-19T07:00:41","slug":"114-2","status":"publish","type":"page","link":"https:\/\/firstyatl.my.id\/?page_id=114","title":{"rendered":""},"content":{"rendered":"    <div class=\"sentiment-analyzer-container\" style=\"max-width: 500px; margin: 20px 0; font-family: sans-serif;\">\r\n        <label for=\"sentiment-input\" style=\"display: block; font-weight: bold; margin-bottom: 8px;\">Enter your text to check sentiment:<\/label>\r\n        <textarea id=\"sentiment-input\" rows=\"5\" style=\"width: 100%; padding: 10px; border: 1px solid #ccc; border-radius: 4px; box-sizing: border-box; font-size: 14px;\" placeholder=\"Type or paste your text here...\"><\/textarea>\r\n        \r\n        <button id=\"analyze-sentiment-btn\" style=\"margin-top: 10px; padding: 10px 20px; background-color: #0073aa; color: #fff; border: none; border-radius: 4px; cursor: pointer; font-weight: bold;\">Analyze Text<\/button>\r\n        \r\n        <div id=\"sentiment-output\" style=\"margin-top: 15px; padding: 12px; border-radius: 4px; display: none; border: 1px solid transparent;\">\r\n            <strong>Result:<\/strong> <span id=\"sentiment-label\"><\/span>\r\n            <div id=\"sentiment-score-details\" style=\"font-size: 0.85em; margin-top: 5px;\"><\/div>\r\n        <\/div>\r\n    <\/div>\r\n\r\n    <script>\r\n    document.addEventListener('DOMContentLoaded', function() {\r\n        const btn = document.getElementById('analyze-sentiment-btn');\r\n        const input = document.getElementById('sentiment-input');\r\n        const outputDiv = document.getElementById('sentiment-output');\r\n        const labelSpan = document.getElementById('sentiment-label');\r\n        const detailsDiv = document.getElementById('sentiment-score-details');\r\n\r\n        \/\/ Built-in sentiment dictionary (AFINN-based weights)\r\n        const sentimentLexicon = {\r\n            \/\/ Positive words\r\n            'good': 3, 'faith': 2, 'structured': 1, 'inclusive': 2, 'bound': 1, 'agree': 1, 'agreed': 2,\r\n            'great': 3, 'excellent': 4, 'happy': 3, 'love': 3, 'amazing': 4, 'best': 3, 'success': 3,\r\n            'progress': 2, 'support': 2, 'trust': 2, 'helpful': 2, 'benefit': 2, 'safe': 2, 'true': 1,\r\n            'perfect': 4, 'glad': 3, 'pleased': 3, 'satisfactory': 2, 'creative': 2, 'optimum': 3,\r\n\r\n            \/\/ Negative words\r\n            'harm': -3, 'harms': -3, 'slave': -4, 'trade': -1, 'historical': -1, 'apology': -1,\r\n            'bad': -3, 'worst': -4, 'hate': -3, 'sad': -2, 'terrible': -4, 'wrong': -2, 'error': -2,\r\n            'fail': -2, 'failure': -3, 'regret': -2, 'fault': -2, 'problem': -2, 'issue': -1,\r\n            'difficult': -1, 'poor': -2, 'unfortunately': -2, 'delay': -1, 'conflict': -2, 'prospect': -1\r\n        };\r\n\r\n        btn.addEventListener('click', function() {\r\n            const text = input.value.trim();\r\n            if (!text) {\r\n                alert('Please enter some text first.');\r\n                return;\r\n            }\r\n\r\n            \/\/ Clean text and tokenize into words\r\n            const words = text.toLowerCase()\r\n                              .replace(\/[.,\\\/#!$%\\^&\\*;:{}=\\-_`~()?\"'\\n]\/g, \" \")\r\n                              .split(\/\\s+\/);\r\n\r\n            let score = 0;\r\n            let matchedWords = [];\r\n\r\n            \/\/ Score calculation loop\r\n            words.forEach(word => {\r\n                if (sentimentLexicon.hasOwnProperty(word)) {\r\n                    score += sentimentLexicon[word];\r\n                    matchedWords.push(word);\r\n                }\r\n            });\r\n\r\n            \/\/ Layout states\r\n            let label = 'Neutral \ud83d\ude10';\r\n            let bgColor = '#fbfbfb';\r\n            let borderColor = '#ccc';\r\n            let textColor = '#333';\r\n\r\n            if (score > 0) {\r\n                label = 'Positive \ud83d\ude0a';\r\n                bgColor = '#e6f4ea';\r\n                borderColor = '#137333';\r\n                textColor = '#137333';\r\n            } else if (score < 0) {\r\n                label = 'Negative \ud83d\ude1e';\r\n                bgColor = '#fce8e6';\r\n                borderColor = '#c5221f';\r\n                textColor = '#c5221f';\r\n            }\r\n\r\n            \/\/ Render Output update\r\n            labelSpan.textContent = label;\r\n            detailsDiv.innerHTML = `<strong>Total Score:<\/strong> ${score} <br> <strong>Matched Indicators:<\/strong> ${matchedWords.length > 0 ? matchedWords.join(', ') : 'None'}`;\r\n            \r\n            outputDiv.style.backgroundColor = bgColor;\r\n            outputDiv.style.borderColor = borderColor;\r\n            outputDiv.style.color = textColor;\r\n            outputDiv.style.display = 'block';\r\n        });\r\n    });\r\n    <\/script>\r\n    \n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-114","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/firstyatl.my.id\/index.php?rest_route=\/wp\/v2\/pages\/114","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/firstyatl.my.id\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/firstyatl.my.id\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/firstyatl.my.id\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/firstyatl.my.id\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=114"}],"version-history":[{"count":1,"href":"https:\/\/firstyatl.my.id\/index.php?rest_route=\/wp\/v2\/pages\/114\/revisions"}],"predecessor-version":[{"id":116,"href":"https:\/\/firstyatl.my.id\/index.php?rest_route=\/wp\/v2\/pages\/114\/revisions\/116"}],"wp:attachment":[{"href":"https:\/\/firstyatl.my.id\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=114"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}