pronoun
Version:
English Pronouns
62 lines (61 loc) • 4.16 kB
JavaScript
function pronoun(type, num) {
const personalPronouns = ["I","we","you","he","she","it","they"]
const objectPronouns = ["me","us","you","her","him","it","them"]
const possessivePronouns = ["mine","ours","yours","hers","his","theirs"]
const reflexivePronouns = ["myself","yourself","herself","himself","itself","ourselves","yourselves","themselves"]
const intensivePronouns = ["myself","yourself","herself","himself","itself","ourselves","yourselves","themselves"]
const indefinitePronouns = ["all","another","any","anybody","anyone","anything","both","each","either","everybody","everyone","everything","few","many","most","neither","nobody","none","no","one","nothing","one","other","others","several","some","somebody","someone","something","such"]
const demonstrativePronouns = ["such","that","these","this","those"]
const interrogativePronouns = ["what","whatever","which","whichever","who","whoever","whom","whomever","whose"]
const relativePronouns = ["as","that","what","whatever","which","whichever","who","whoever","whom","whomever","whose"]
const archaicPronouns = ["thou","thee","thy","thine","ye"]
const allPronouns = ["all","another","any","anybody","anyone","anything","as","aught","both","each","each","other","either","enough","everybody","everyone","everything","few","he","her","hers","herself","him","himself","his","I","idem","it","its","itself","many","me","mine","most","my","myself","naught","neither","no","one","nobody","none","nothing","nought","one","one","another","other","others","ought","our","ours","ourself","ourselves","several","she","some","somebody","someone","something","somewhat","such","suchlike","that","thee","their","theirs","theirself","theirselves","them","themself","themselves","there","these","they","thine","this","those","thou","thy","thyself","us","we","what","whatever","whatnot","whatsoever","whence","where","whereby","wherefrom","wherein","whereinto","whereof","whereon","wherever","wheresoever","whereto","whereunto","wherewith","wherewithal","whether","which","whichever","whichsoever","who","whoever","whom","whomever","whomso","whomsoever","whose","whosever","whosesoever","whoso","whosoever","ye","yon","yonder","you","your","yours","yourself","yourselves"]
const pronounExamples = [
"His son has been kidnapped.",
"I had forgotten my wallet in the room.",
"He is a good boy.",
"Someone knows where she is.",
"Everything was ready for the party.",
"Everyone wants to improve themselves.",
"He is planning to hide behind the door.",
"They are good at playing basketball."
]
if (type == 'personal' || type == 'subject') { return personalPronouns; }
else if (type == 'object') { return objectPronouns; }
else if (type == 'possessive') { return possessivePronouns; }
else if (type == 'reflexive') { return reflexivePronouns; }
else if (type == 'intensive') { return intensivePronouns; }
else if (type == 'indefinite') { return indefinitePronouns; }
else if (type == 'demonstrative') { return demonstrativePronouns; }
else if (type == 'interrogative') { return interrogativePronouns; }
else if (type == 'relative') { return relativePronouns; }
else if (type == 'archaic') { return archaicPronouns; }
else if (type == 'wikiPage') { return 'https://en.wikipedia.org/wiki/Pronoun'; }
else if (type == 'example') {
const n = num || 1;
let g;
const arr = [];
for (let i = 0; i < n; i++) {
const r = () => {
g = Math.floor(Math.random() * pronounExamples.length);
};
r();
function t() {
if (arr.includes(pronounExamples[g])) {
r();
t();
} else {
arr.push(pronounExamples[g]);
}
}
t();
}
if(arr.length = 1) {
return arr[0]
} else {
return arr;
}
}
else { return allPronouns; }
}
export { pronoun };