Snippets Collections
// Variable 'search' initialized with the string that will be used for the Google search
let search = "Google * and SEO";

// Replace the first space character in the 'search' string with a plus sign
let searchQ = search.replace(' ', '+').trim();
// Construct the Google search URL using the modified 'searchQ' string and setting the results limit to 1000
let searchUrl = `https://www.google.com/search?q=%22${searchQ}%22&num=1000`;

// URL to a raw list of English stop words from the NLTK library hosted on GitHub
let stopwordsUrl = "https://gist.githubusercontent.com/sebleier/554280/raw/7e0e4a1ce04c2bb7bd41089c9821dbcf6d0c786c/NLTK's%20list%20of%20english%20stopwords";

// Initialize 'stopWords' as a Set to store unique stop words
let stopWords = new Set();

// Asynchronously fetch the list of stopwords from the provided URL
fetch(stopwordsUrl)
  .then(response => {
    // Check if the network response is ok; otherwise throw an error
    if (!response.ok) throw new Error('Network response was not ok');
    return response.text(); // Return the response text (stop words) to be processed
  })
  .then(stopwordsData => {
    // Split the stopwords data by newlines and add each trimmed word to the 'stopWords' Set
    stopwordsData.split(/\n/).forEach(word => stopWords.add(word.trim()));
    return fetch(searchUrl); // Fetch the Google search results next
  })
  .then(response => {
    // Check if the network response is ok; otherwise throw an error
    if (!response.ok) throw new Error('Network response was not ok');
    return response.text(); // Return the search HTML to be processed
  })
  .then(data => {
    // Parse the returned HTML string into a DOM Document object
    let _htmlDoc = new DOMParser().parseFromString(data, "text/html");

    // Define a threshold percentile for word frequency analysis
    const bottomPercentile = 0.98;

    // Process and filter h3 text content from the Google search results
    let processedTexts = Array.from(_htmlDoc.querySelectorAll('h3')).map(h3 => 
      h3.textContent.trim().toLowerCase() // Remove whitespace, convert to lower case
      .replace(/[^\w\s]|_/g, "") // Remove punctuation and underscores
      .split(/\s+/).filter(word => !stopWords.has(word)) // Split into words and filter out stop words
    );

    // Count the frequency of each word across all h3 elements
    let wordCounts = processedTexts.flatMap(words => words).reduce((acc, word) => {
        acc[word] = (acc[word] || 0) + 1; // Increment word count or initialize it to 1
        return acc;
    }, {});

    // Sort the frequencies to determine the threshold for common words
    let sortedCounts = Object.values(wordCounts).sort((a, b) => a - b);
    let thresholdIndex = Math.floor(sortedCounts.length * bottomPercentile);
    let thresholdValue = sortedCounts[thresholdIndex];

    // Filter out the words that are more frequent than the threshold
    let frequentWords = new Set(Object.keys(wordCounts).filter(word => wordCounts[word] > thresholdValue));

    // Reconstruct texts by removing the frequent words and ensure they are more than single words
    let reconstructedText = new Set(processedTexts
      .map(words => words.filter(word => !frequentWords.has(word)).join(' '))
      .filter(text => text.split(' ').length > 1));

    // Log each reconstructed text to the console
    reconstructedText.forEach(text => console.log(text));
  })
  .catch(error => console.error('Fetch error:', error)); // Catch and log any errors during the fetch process
add_filter( 'document_title_separator', 'snippetpress_title_separator' );
function snippetpress_title_separator() {
 
    return '|';
 
}
<div>
Begin Here


</div>



<script type="application/ld+json">
   //<![CDATA[
{
  "@context": {
    "dc": "http://purl.org/dc/elements/1.1/",
    "ex": "http://example.org/vocab#",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "ex:contains": {
      "@type": "@id"
    }
  },
"@type": "http://schema.org/BlogPosting",
"articleBody" :".",
"wordCount": "570",
"about" : "Using filler words inside character dialog, as an enhancement for emmersion. Used as character identification, personality, emotional conveyance. ",
"author" :  {
    "@type" : "Person",
    "name" : "Glenn Hefley",
    "jobTitle": "Fiction Novelist",
    "email": "ghefley@gmail.com"
  },
"datePublished" : "2021-11-03",
"genre" : "Non-Fiction",
"headline" : "Do You Use Filler Words in your Dialog? Why Not?",
"keywords" : "Fiction, Writing, Novelist, Language, Using Language, dialog, characterization, immersion",
"text" : ".",
"url" : "https://glennhefley.blogspot.com/"

}
  //]]>
</script>


<script type="application/ld+json">
 //<![CDATA[
{ "@context" : "http://schema.org",
  "@type" : "Person",
  "name" : "Glenn Hefley",
  "email" : "ghefley@gmail.com",
  "ResearchID":"S-2691-2017",
  "ORCID": "0000-0001-7495-5377",
  "url" : "https://glennhefley.blogspot.com/",
  "sameAs" : [ "http://www.facebook.com/glennhefley",
      "http://www.linkedin.com/in/glennhefley",
      "https://twitter.com/glennhefley",
      "https://www.facebook.com/scionmancer",
      "https://psyopwriter.wordpress.com/author/ghefley/",
      "https://medium.com/@glennhefley",
      "http://orcid.org/0000-0001-7495-5377",
      "https://scholar.google.com/citations?user=PTB9Uqt1mk4J"] 
}
  //]]>
</script>

<style>
@import url('https://fonts.googleapis.com/css2?family=Bitter&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Quicksand&display=swap');  
</style>
<style type="text/css">
h1,h2,h3,h4,h5,h6{color:#201E20;}
  aside {
    width: 40%;
    padding-left: .5rem;
    margin-left: .5rem;
    float: right;
    box-shadow: inset 5px 0 5px -5px #29627e;
    font-style: normal;
    color: #29627e;
}
  aside > h1 {
    font-family: 'Bitter', serif;
    font-size:18px;
    line-height:19px;
    
  }
aside > p {
    margin: .4rem;
    font-size:14px;
    line-height:18px;
    font-family: 'Quicksand', sans-serif;
}

</style>



<p>&nbsp;</p><div class="separator" style="clear: both; text-align: center;"></div><br />

<div><p></p></div><br />
<div><p></p></div><br />

<div><aside><p>Using filler words inside character dialog, as an enhancement for immersion. Used as character identification, personality, emotional conveyance.</p></aside></div><br />

<h1>This is heading 1</h1>
<h2>This is heading 2</h2>
<h3>This is heading 3</h3>
<h4>This is heading 4</h4>
<h5>This is heading 5</h5>
<h6>This is heading 6</h6>
star

Wed Dec 13 2023 01:05:53 GMT+0000 (Coordinated Universal Time) https://snippets.cacher.io/snippet/43d97624291091879319

#seo #javascript #js #google #serp
star

Sat Mar 25 2023 23:22:48 GMT+0000 (Coordinated Universal Time) https://myaccount.google.com/profile?hl=en

#google #seo #website #development #marketing
star

Sat Mar 25 2023 23:18:06 GMT+0000 (Coordinated Universal Time) https://myaccount.google.com/profile/profiles-summary

#profile #seo #google #website #development #marketing
star

Sat Apr 16 2022 07:54:56 GMT+0000 (Coordinated Universal Time) https://snippetpress.com/change-the-wordpress-page-title-separator-without-a-plugin/

#php #seo
star

Tue Mar 01 2022 07:12:01 GMT+0000 (Coordinated Universal Time) https://www.notion.so/cec5c75876c443e096aebca67bc5b5f6 is the NOtion page I have it on, but that may not be accessible to you.

##bigdata #dataprints #massive #seo #alterations
star

Sun Jan 05 2020 19:00:00 GMT+0000 (Coordinated Universal Time)

#html #basics #htmltags #seo

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension