Hey 
It’s a cool question, so I made you a vanilla JS ‘plugin’.
What it does:
- separates quoted and unquoted strings.
- sums the words of each
- calculates the % of quoted words.
For example, this text:
hey look at that
“hey look at that”
“hey look at that”
“hey look at that”
Returns this (in console):
* FINISHED *
QUOTED word count = 12
UNQUOTED word count = 4
QUOTED PERCENTAGE === 75%
**
You can also turn on “MONITOR MODE” which displays details:
= added to UNQUOTED: 4 || UNQUOTED Total: 4
The LINE is: hey,look,at,that
= added to QUOTED: 4 || QUOTED Total: 4
The LINE is: hey,look,at,that
= added to QUOTED: 4 || QUOTED Total: 8
The LINE is: hey,look,at,that
= added to QUOTED: 4 || QUOTED Total: 12
The LINE is: hey,look,at,that
**
Here is the vanilla JS:
// SET TO TRUE FOR "MONITOR MODE" (to show stats, quoted/unquoted phrases in console)
quoteSift(false);
function quoteSift(x) {
// get all cm-lines in active tab
var lineText = document.querySelectorAll(".workspace-leaf.mod-active .cm-content .cm-line");
let fullText = "";
//join all lines, remove leading/trailing spaces, remove double spaces
console.log("======= new run || monitor mode: " + x + " =======");
let z = lineText.length;
for (var c = 0; c < z; c++) {
let liner = lineText[c].innerText.trim();
if (c > 0) {fullText = fullText + " " + liner;}
if (c === 0) {fullText = liner;}
}
fullText = fullText.replace(/\s+/g, ' ');
if (x) {console.log("fulltext: " + fullText);}
// split at " ... count words in each segment. sum non-quoted words. sum quoted words
let textArray = fullText.split(/(\")/);
let d = quoteCount = nonCount = 0;
for (var c = 0; c < textArray.length; c++) {
let g = textArray[c].trim();
let wordCount = g.split(' ').length;
let gLine = g.split(' ');
let b = g[0]; // get first character of string
if (b === '"') { // toggle quoted/unquoted string
if (d === 0) {d = 1; continue;}
if (d === 1) {d = 0; continue;}
}
if (typeof b === 'undefined') {continue;} // catch hidden characters/breaks
if (d === 0) {
nonCount = nonCount + wordCount;
if (x) {console.log("=== added to UNQUOTED: " + wordCount + " || UNQUOTED Total: " + nonCount + "\nThe LINE is: " + gLine );}
continue;
}
if (d === 1) {
quoteCount = quoteCount + wordCount;
if (x) {console.log("=== added to QUOTED: " + wordCount + " || QUOTED Total: " + quoteCount + "\nThe LINE is: " + gLine );}
if (c === (textArray.length - 1)) {console.log("NOTE - Probably missing end quote");}
}
}
let qPercent = ((quoteCount / (nonCount + quoteCount)) * 100); // get final percentage
console.log("* FINISHED *\nQUOTED word count = " + quoteCount + "\nUNQUOTED word count = " + nonCount + "\nQUOTED PERCENTAGE === " + qPercent + "%");
}
or private-bin if you prefer.
**
I’m glad you found a solution though.
Figured I should send this anyway, since it’s complete. @holroy @CawlinTeffid
[NOTE: I’m using the “Javascript Init” community-plugin to add that JS to Obsidian]
I hope you have a good day 