Pig Latin: consider 'qu-' and 'squ' words

Pig Latin: consider 'qu-' and 'squ' words
0.0 0


This post may be a bit nerdish, but FYI for anyone interested :wink:. When looking over the proposed guide solutions for the pig latin conversion exercise I noticed that none consider ‘qu-’ or ‘squ’ words (e.g., ‘quiet’, ‘squire’). As regex practice I modified one of the given solutions to account for these terms:

function translatePigLatin(str) {
	str = str
		.replace(/^([aeiou])(.*)/, '$1$2way')
		.replace(/^([^u][squ]+|[^u][qu]+|[^aeiou]+)(.*)/, '$2$1ay');


The code then produces iresquay for ‘squire’, idsquay for ‘squid’, otequay for ‘quote’, and so forth.

The next permutation should also account for consonantal/vocalic/semivocalic initial ‘y-’ terms. My inclination is to treat most initial ‘y-’ words as consonantal based on phonetic considerations for common ‘y-’ terms, though they are arguably semivocalic (the above code does not include ‘y’ with the vowel range). However, it is not this simple, as initial ‘y’ in some technical terms is clearly vocalic (e.g., yttrium, ytterbium, ylem; so also some personal names and archaic terms). Perhaps ‘y’ is vocalic immediately before a consonant?

Any thoughts by someone with an English background :thinking: ?


I think that’s a safe bet. English phonology does not allow for any consonant clusters that include palatal approximates that I can think of (jd*, jt*, jd*, jp*, jb*, etc), certainly not at the beginning of words. It seems to always be a short mid-high vowel in that environment. If you go so far as to replace such a y with an i, it would probably make the result more readable, too.