From 8e064b7f7e8a98b02e08d3f4f4f7ccbff2f16b3b Mon Sep 17 00:00:00 2001 From: Hanna Worku Date: Fri, 30 Aug 2024 13:23:09 +0200 Subject: [PATCH 1/2] add the phrase dumb down and improve feedback for the phrase lame --- .../disabilityAssessmentsSpec.js | 86 ++++++++++++++++--- .../configuration/disabilityAssessments.js | 15 +++- 2 files changed, 86 insertions(+), 15 deletions(-) diff --git a/packages/yoastseo/spec/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessmentsSpec.js b/packages/yoastseo/spec/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessmentsSpec.js index 006ac9493d5..0ab1a015090 100644 --- a/packages/yoastseo/spec/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessmentsSpec.js +++ b/packages/yoastseo/spec/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessmentsSpec.js @@ -154,6 +154,16 @@ describe( "A test for Disability assessments", function() { expect( assessment.isApplicable( mockPaper, mockResearcher ) ).toBe( false ); } ); + it( "should not target 'dumb' if followed by 'down'.", () => { + const assessment = new InclusiveLanguageAssessment( assessments.find( obj => obj.identifier === "dumb" ) ); + + const testSentence = "They're not used to dumbing down their articles."; + const mockPaper = new Paper( testSentence ); + const mockResearcher = Factory.buildMockResearcher( [ testSentence ] ); + + expect( assessment.isApplicable( mockPaper, mockResearcher ) ).toBe( false ); + } ); + it( "correctly identifies 'the disabled' which is only recognized when followed by participle or simple past tense", () => { const mockPaper = new Paper( "the disabled worked, the better they are." ); const mockResearcher = Factory.buildMockResearcher( [ "The disabled worked, the better they are." ] ); @@ -550,26 +560,29 @@ describe( "a test for targeting non-inclusive phrases in disability assessments" { identifier: "lame", text: "Such a lame excuse!", - expectedFeedback: "Avoid using lame as it is potentially harmful. Consider using an alternative, such as boring, lousy, " + - "unimpressive, sad, corny. Learn more.", - expectedScore: 3, + expectedFeedback: "Be careful when using lame as it is potentially harmful. Unless you are " + + "referring to an object, considering using an alternative. For example, boring, lousy, " + + "unimpressive, sad, corny. If referring to someone's disability, use an alternative such " + + "as person with a disability, person who has difficulty with walking. Learn more.", + expectedScore: 6, }, { identifier: "lamer", text: "It is a lamer excuse compared to the previous one.", - expectedFeedback: "Avoid using lamer as it is potentially harmful. Consider using an alternative, such as more boring, " + - "lousier, more unimpressive, sadder, cornier. Learn more.", - expectedScore: 3, + expectedFeedback: "Be careful when using lame as it is potentially harmful. Unless you are " + + "referring to an object, considering using an alternative. For example, boring, lousy, " + + "unimpressive, sad, corny. If referring to someone's disability, use an alternative such " + + "as person with a disability, person who has difficulty with walking. Learn more.", + expectedScore: 6, }, { identifier: "lamest", text: "This is the lamest excuse by far!", - expectedFeedback: - "Avoid using lamest as it is potentially harmful. Consider using an alternative, such as most boring, " + - "lousiest, most unimpressive, saddest, corniest. Learn more.", - expectedScore: 3, + expectedFeedback: "Be careful when using lame as it is potentially harmful. Unless you are " + + "referring to an object, considering using an alternative. For example, boring, lousy, " + + "unimpressive, sad, corny. If referring to someone's disability, use an alternative such " + + "as person with a disability, person who has difficulty with walking. Learn more.", + expectedScore: 6, }, ]; @@ -1129,6 +1142,55 @@ describe( "a test for targeting non-inclusive phrases in disability assessments" testInclusiveLanguageAssessments( testData ); } ); + it( "should return the appropriate score and feedback string for: 'dumb down' and its other forms", () => { + // The different forms of "dumb down" is one entry under the same identifier. + const testData = [ + { + identifier: "dumbDown", + text: "They had to dumb it down for him.", + expectedFeedback: "Avoid using dumb it down as it is potentially harmful. Consider using an alternative, such as oversimplify. " + + "Learn more.", + expectedScore: 3, + }, + { + identifier: "dumbDown", + text: "They dumbed it down for him.", + expectedFeedback: "Avoid using dumb it down as it is potentially harmful. Consider using an alternative, such as oversimplify. " + + "Learn more.", + expectedScore: 3, + }, + { + identifier: "dumbDown", + text: "They are dumbing it down for him.", + expectedFeedback: "Avoid using dumb it down as it is potentially harmful. Consider using an alternative, such as oversimplify. " + + "Learn more.", + expectedScore: 3, + }, + { + identifier: "dumbDown", + text: "They had to dumb down the reasoning for him.", + expectedFeedback: "Avoid using dumb it down as it is potentially harmful. Consider using an alternative, such as oversimplify. " + + "Learn more.", + expectedScore: 3, + }, + { + identifier: "dumbDown", + text: "They dumbed down the reasoning for him.", + expectedFeedback: "Avoid using dumb it down as it is potentially harmful. Consider using an alternative, such as oversimplify. " + + "Learn more.", + expectedScore: 3, + }, + { + identifier: "dumbDown", + text: "They are dumbing down the reasoning for him.", + expectedFeedback: "Avoid using dumb it down as it is potentially harmful. Consider using an alternative, such as oversimplify. " + + "Learn more.", + expectedScore: 3, + }, + ]; + + testInclusiveLanguageAssessments( testData ); + } ); it( "should return the appropriate score and feedback string for: 'psycho' and its plural form", () => { // The different forms of "psycho" is one entry under the same identifier. const testData = [ diff --git a/packages/yoastseo/src/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessments.js b/packages/yoastseo/src/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessments.js index 18d7bb0dc5f..0b14a819a00 100644 --- a/packages/yoastseo/src/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessments.js +++ b/packages/yoastseo/src/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessments.js @@ -215,9 +215,10 @@ const disabilityAssessments = [ { identifier: "lame", nonInclusivePhrases: [ "lame" ], - inclusiveAlternatives: "boring, lousy, unimpressive, sad, corny", - score: SCORES.NON_INCLUSIVE, - feedbackFormat: redHarmful, + inclusiveAlternatives: "boring, lousy, unimpressive, sad, corny, person with a disability, person who has difficulty with walking", + score: SCORES.POTENTIALLY_NON_INCLUSIVE, + feedbackFormat: [ "Be careful when using %1$s as it is potentially harmful. " + + "Unless you are referring to an object, considering using an alternative. For example, %1$s. If referring to someone's disability, use an alternative such as %2$s." ], }, { identifier: "lamer", @@ -317,6 +318,14 @@ const disabilityAssessments = [ score: SCORES.NON_INCLUSIVE, feedbackFormat: redHarmful, }, + { + identifier: "dumbDown", + nonInclusivePhrases: [ "dumb down", "dumbing down", "dumbed down", "dumb it down", "dumbing it down", + "dumbed it down" ], + inclusiveAlternatives: "oversimplify", + score: SCORES.NON_INCLUSIVE, + feedbackFormat: redHarmful, + }, { identifier: "dumb", nonInclusivePhrases: [ "dumb", "dumber", "dumbest" ], From 0f1dcd49a91ed50ffd583cde5d299e8404b9bee3 Mon Sep 17 00:00:00 2001 From: Hanna Worku Date: Fri, 30 Aug 2024 15:33:35 +0200 Subject: [PATCH 2/2] update feedback for other forms of the word lame --- .../configuration/disabilityAssessmentsSpec.js | 8 ++++---- .../configuration/disabilityAssessments.js | 14 ++++++++------ 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/packages/yoastseo/spec/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessmentsSpec.js b/packages/yoastseo/spec/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessmentsSpec.js index 0ab1a015090..af4e4587984 100644 --- a/packages/yoastseo/spec/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessmentsSpec.js +++ b/packages/yoastseo/spec/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessmentsSpec.js @@ -570,8 +570,8 @@ describe( "a test for targeting non-inclusive phrases in disability assessments" identifier: "lamer", text: "It is a lamer excuse compared to the previous one.", expectedFeedback: "Be careful when using lame as it is potentially harmful. Unless you are " + - "referring to an object, considering using an alternative. For example, boring, lousy, " + - "unimpressive, sad, corny. If referring to someone's disability, use an alternative such " + + "referring to an object, considering using an alternative. For example, more boring, lousier, " + + "more unimpressive, sadder, cornier. If referring to someone's disability, use an alternative such " + "as person with a disability, person who has difficulty with walking. Learn more.", expectedScore: 6, }, @@ -579,8 +579,8 @@ describe( "a test for targeting non-inclusive phrases in disability assessments" identifier: "lamest", text: "This is the lamest excuse by far!", expectedFeedback: "Be careful when using lame as it is potentially harmful. Unless you are " + - "referring to an object, considering using an alternative. For example, boring, lousy, " + - "unimpressive, sad, corny. If referring to someone's disability, use an alternative such " + + "referring to an object, considering using an alternative. For example, most boring, lousiest," + + " most unimpressive, saddest, corniest. If referring to someone's disability, use an alternative such " + "as person with a disability, person who has difficulty with walking. Learn more.", expectedScore: 6, }, diff --git a/packages/yoastseo/src/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessments.js b/packages/yoastseo/src/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessments.js index 0b14a819a00..e2771153a93 100644 --- a/packages/yoastseo/src/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessments.js +++ b/packages/yoastseo/src/scoring/assessments/inclusiveLanguage/configuration/disabilityAssessments.js @@ -223,16 +223,18 @@ const disabilityAssessments = [ { identifier: "lamer", nonInclusivePhrases: [ "lamer" ], - inclusiveAlternatives: "more boring, lousier, more unimpressive, sadder, cornier", - score: SCORES.NON_INCLUSIVE, - feedbackFormat: redHarmful, + inclusiveAlternatives: "more boring, lousier, more unimpressive, sadder, cornier, person with a disability, person who has difficulty with walking", + score: SCORES.POTENTIALLY_NON_INCLUSIVE, + feedbackFormat: [ "Be careful when using %1$s as it is potentially harmful. " + + "Unless you are referring to an object, considering using an alternative. For example, %1$s. If referring to someone's disability, use an alternative such as %2$s." ], }, { identifier: "lamest", nonInclusivePhrases: [ "lamest" ], - inclusiveAlternatives: "most boring, lousiest, most unimpressive, saddest, corniest", - score: SCORES.NON_INCLUSIVE, - feedbackFormat: redHarmful, + inclusiveAlternatives: "most boring, lousiest, most unimpressive, saddest, corniest, person with a disability, person who has difficulty with walking", + score: SCORES.POTENTIALLY_NON_INCLUSIVE, + feedbackFormat: [ "Be careful when using %1$s as it is potentially harmful. " + + "Unless you are referring to an object, considering using an alternative. For example, %1$s. If referring to someone's disability, use an alternative such as %2$s." ], }, { identifier: "commitSuicide",