Skip to content

Commit

Permalink
Merge pull request #21616 from Yoast/21532-check-suggested-turkish-tr…
Browse files Browse the repository at this point in the history
…ansition-words

Extends Transition words list for Turkish after user feedback
  • Loading branch information
FAMarfuaty authored Sep 23, 2024
2 parents 5723473 + b066456 commit 9df7465
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const expectedResults = {
textTransitionWords: {
isApplicable: true,
score: 3,
resultText: "<a href='https://yoa.st/34z' target='_blank'>Transition words</a>: Only 5.5% of the sentences contain transition words, " +
resultText: "<a href='https://yoa.st/34z' target='_blank'>Transition words</a>: Only 6.8% of the sentences contain transition words, " +
"which is not enough. <a href='https://yoa.st/35a' target='_blank'>Use more of them</a>.",
},
passiveVoice: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,20 @@ import Paper from "../../../src/values/Paper.js";
import EnglishResearcher from "../../../src/languageProcessing/languages/en/Researcher";
import FrenchResearcher from "../../../src/languageProcessing/languages/fr/Researcher";
import JapaneseResearcher from "../../../src/languageProcessing/languages/ja/Researcher";
import GermanResearcher from "../../../src/languageProcessing/languages/de/Researcher";
import DutchResearcher from "../../../src/languageProcessing/languages/nl/Researcher";
import SpanishResearcher from "../../../src/languageProcessing/languages/es/Researcher";
import ItalianResearcher from "../../../src/languageProcessing/languages/it/Researcher";
import PortugueseResearcher from "../../../src/languageProcessing/languages/pt/Researcher";
import CatalanResearcher from "../../../src/languageProcessing/languages/ca/Researcher";
import PolishResearcher from "../../../src/languageProcessing/languages/pl/Researcher";
import HungarianResearcher from "../../../src/languageProcessing/languages/hu/Researcher";
import SwedishResearcher from "../../../src/languageProcessing/languages/sv/Researcher";
import IndonesianResearcher from "../../../src/languageProcessing/languages/id/Researcher";
import TurkishResearcher from "../../../src/languageProcessing/languages/tr/Researcher";
import RussianResearcher from "../../../src/languageProcessing/languages/ru/Researcher";
import HebrewResearcher from "../../../src/languageProcessing/languages/he/Researcher";
import ArabicResearcher from "../../../src/languageProcessing/languages/ar/Researcher";

// eslint-disable-next-line max-statements
describe( "a test for finding transition words from a string", function() {
Expand Down Expand Up @@ -41,23 +55,23 @@ describe( "a test for finding transition words from a string", function() {
expect( result.transitionWordSentences ).toBe( 1 );
} );

it( "returns 1 when a two-part transition word is found in a sentence (English)", function() {
it( "returns 1 when a two-part transition word is found in a sentence (English)", function() {
// Transition word: either...or.
mockPaper = new Paper( "I will either tell you a story, or read you a novel.", { locale: "en_US" } );
result = transitionWordsResearch( mockPaper, new EnglishResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 1 );
} );

it( "returns 1 when a two-part transition word is found in a sentence, and no transition word in another sentence. (English)", function() {
it( "returns 1 when a two-part transition word is found in a sentence, and no transition word in another sentence. (English)", function() {
// Transition word: either...or.
mockPaper = new Paper( "I will either tell you a story, or read you a novel. Okay?", { locale: "en_US" } );
result = transitionWordsResearch( mockPaper, new EnglishResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 2 );
expect( result.transitionWordSentences ).toBe( 1 );
} );

it( "returns 2 when a two-part transition word is found in a sentence, and a transition word in another sentence. (English)", function() {
it( "returns 2 when a two-part transition word is found in a sentence, and a transition word in another sentence. (English)", function() {
// Transition words: either...or, unless.
mockPaper = new Paper( "I will either tell you a story, or read you a novel. Unless it is about a boy.", { locale: "en_US" } );
result = transitionWordsResearch( mockPaper, new EnglishResearcher( mockPaper ) );
Expand All @@ -66,18 +80,18 @@ describe( "a test for finding transition words from a string", function() {
} );

it( "returns 2 when a two-part transition word is found in two sentences. (English)", function() {
// Transition words: either...or, if...then.
mockPaper = new Paper( "I will either tell you a story, or read you a novel. If you want, then I will.", { locale: "en_US" } );
// Transition words: either...or, both...and.
mockPaper = new Paper( "I will either tell you a story, or read you a novel. She was both furious and disappointed.", { locale: "en_US" } );
result = transitionWordsResearch( mockPaper, new EnglishResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 2 );
expect( result.transitionWordSentences ).toBe( 2 );
} );

it( "returns 2 when a two-part transition word is found in two sentences, " +
"and an additional transition word is found in one of them. (English)", function() {
// Transition words: either...or, if ...then, as soon as.
// Transition words: either...or, both...and, as soon as.
mockPaper = new Paper( "I will either tell you a story about a boy, or read you a novel. " +
"If you want, then I will start as soon as you're ready.", { locale: "en_US" } );
"I can read it to both you and her as soon as you're ready.", { locale: "en_US" } );
result = transitionWordsResearch( mockPaper, new EnglishResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 2 );
expect( result.transitionWordSentences ).toBe( 2 );
Expand Down Expand Up @@ -159,7 +173,7 @@ describe( "a test for finding transition words from a string", function() {
expect( result.transitionWordSentences ).toBe( 0 );
} );

/*it( "returns 1 when a transition word is found in a sentence (German)", function() {
it( "returns 1 when a transition word is found in a sentence (German)", function() {
// Transition word: zuerst.
mockPaper = new Paper( "Zuerst werde ich versuchen zu verstehen, warum er so denkt.", { locale: "de_DE" } );
result = transitionWordsResearch( mockPaper, new GermanResearcher( mockPaper ) );
Expand Down Expand Up @@ -190,8 +204,8 @@ describe( "a test for finding transition words from a string", function() {
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 0 );
} );
*/
/* it( "returns 1 when a transition word is found in a sentence (French)", function() {

it( "returns 1 when a transition word is found in a sentence (French)", function() {
// Transition word: deuxièmement.
mockPaper = new Paper( "Deuxièmement, il convient de reconnaître la complexité des tâches à entreprendre.", { locale: "fr_FR" } );
result = transitionWordsResearch( mockPaper, new FrenchResearcher( mockPaper ) );
Expand All @@ -205,7 +219,7 @@ describe( "a test for finding transition words from a string", function() {
result = transitionWordsResearch( mockPaper, new FrenchResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 1 );
} );*/
} );

it( "returns 1 when a transition word with an apostrophe is found in a sentence (French)", function() {
// Transition word: quoi qu’il en soit.
Expand All @@ -215,7 +229,7 @@ describe( "a test for finding transition words from a string", function() {
expect( result.transitionWordSentences ).toBe( 1 );
} );

/*it( "returns 0 when no transition words are present in a sentence (French)", function() {
it( "returns 0 when no transition words are present in a sentence (French)", function() {
mockPaper = new Paper( "Une, deux, trois.", { locale: "fr_FR" } );
result = transitionWordsResearch( mockPaper, new FrenchResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 1 );
Expand Down Expand Up @@ -353,8 +367,8 @@ describe( "a test for finding transition words from a string", function() {
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 1 );
} );
*/
/*it( "returns 1 when a transition word with a punt volat (·) is found in a sentence (Catalan)", function() {

it( "returns 1 when a transition word with a punt volat (·) is found in a sentence (Catalan)", function() {
// Transition word: per il·lustrar.
mockPaper = new Paper( "Roma proposa un concurs de curtmetratges per il·lustrar com ha de ser la ciutat ideal", { locale: "ca_ES" } );
result = transitionWordsResearch( mockPaper, new CatalanResearcher( mockPaper ) );
Expand Down Expand Up @@ -442,8 +456,9 @@ describe( "a test for finding transition words from a string", function() {
result = transitionWordsResearch( mockPaper, new HungarianResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 1 );
} );*/
/*it( "returns 1 when a three-part transition word is found in a sentence (Hungarian)", function() {
} );

it( "returns 1 when a three-part transition word is found in a sentence (Hungarian)", function() {
// Transition word: nemcsak, hanem, is
mockPaper = new Paper( "Nemcsak a csokoládét szeretem, hanem a süteményt is.", { locale: "hu_HU" } );
result = transitionWordsResearch( mockPaper, new HungarianResearcher( mockPaper ) );
Expand Down Expand Up @@ -487,17 +502,25 @@ describe( "a test for finding transition words from a string", function() {
expect( result.transitionWordSentences ).toBe( 0 );
} );

it( "returns 1 when a transition word is found in a sentence (Turkish)", function() {
it( "returns 1 when a single word transition word is found in a sentence (Turkish)", function() {
// Transition word: ama.
mockPaper = new Paper( "Ama durum bu olmayabilir.", { locale: "tr_TR" } );
result = transitionWordsResearch( mockPaper, new TurkishResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 1 );
} );

it( "returns 1 when two multiple word transition words are found in a sentence (Turkish)", function() {
// Transition words: bir yandan, diğer yandan.
mockPaper = new Paper( "Bir yandan bunu hissediyor, diğer yandan içimden geçenlerin hepsinin boş birer hayal olduğunu düşünüyordum.", { locale: "tr_TR" } );
result = transitionWordsResearch( mockPaper, new TurkishResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 1 );
} );

it( "returns 1 when a two-part transition word is found in a sentence (Turkish)", function() {
// Transition word: hem, hem de.
mockPaper = new Paper( "Hem şapka hem de ceket dolapta.", { locale: "tr_TR" } );
// Transition word: olsun, olmasın.
mockPaper = new Paper( "Тaşıt koltuklarına takılmış olsun veya olmasın baş yastıkların onayı.", { locale: "tr_TR" } );
result = transitionWordsResearch( mockPaper, new TurkishResearcher( mockPaper ) );
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 1 );
Expand Down Expand Up @@ -571,7 +594,7 @@ describe( "a test for finding transition words from a string", function() {
expect( result.totalSentences ).toBe( 1 );
expect( result.transitionWordSentences ).toBe( 1 );
} );
*/

it( "returns 1 when a (multiple) transition word is found in a language that uses a custom" +
" match transition word helper (Japanese)", function() {
// Transition word: ゆえに (tokenized: [ "ゆえ", "に" ])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ const expectedResults = {
},
textTransitionWords: {
isApplicable: true,
score: 6,
resultText: "<a href='https://yoa.st/shopify44' target='_blank'>Transition words</a>: Only 25% of the sentences contain " +
"transition words, which is not enough. <a href='https://yoa.st/shopify45' target='_blank'>Use more of them</a>.",
score: 9,
resultText: "<a href='https://yoa.st/shopify44' target='_blank'>Transition words</a>: Well done!",
},
passiveVoice: {
isApplicable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const singleWords = [ "accordingly", "additionally", "afterward", "afterw
"shortly", "significantly", "similarly", "simultaneously", "since", "so", "soon", "specifically", "still", "straightaway",
"subsequently", "surely", "surprisingly", "than", "then", "thereafter", "therefore", "thereupon", "thirdly", "though",
"thus", "till", "undeniably", "undoubtedly", "unless", "unlike", "unquestionably", "until", "when", "whenever",
"whereas", "while" ];
"whereas", "while", "whether", "if", "actually" ];
export const multipleWords = [ "above all", "after all", "after that", "all in all", "all of a sudden", "all things considered",
"analogous to", "although this may be true", "analogous to", "another key point", "as a matter of fact", "as a result",
"as an illustration", "as can be seen", "as has been noted", "as I have noted", "as I have said", "as I have shown",
Expand Down Expand Up @@ -40,7 +40,7 @@ export const multipleWords = [ "above all", "after all", "after that", "all in a
"to summarize", "to that end", "to the end that", "to this end", "together with", "under those circumstances", "until now",
"up against", "up to the present time", "vis a vis", "what's more", "while it may be true", "while this may be true",
"with attention to", "with the result that", "with this in mind", "with this intention", "with this purpose in mind",
"without a doubt", "without delay", "without doubt", "without reservation" ];
"without a doubt", "without delay", "without doubt", "without reservation", "according to", "no sooner" ];

export const allWords = singleWords.concat( multipleWords );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@
* Returns an array with two-part transition words to be used by the assessments.
* @type {Array} The array filled with two-part transition words.
*/
export default [ [ "both", "and" ], [ "if", "then" ], [ "not only", "but also" ], [ "neither", "nor" ], [ "either", "or" ], [ "not", "but" ],
[ "whether", "or" ], [ "no sooner", "than" ] ];
export default [ [ "both", "and" ], [ "not only", "but also" ], [ "neither", "nor" ], [ "either", "or" ], [ "not", "but" ] ];

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* Returns an array with two-part transition words to be used by the assessments.
* @returns {Array} The array filled with two-part transition words.
*/
export default [ [ "hem", "hem de" ], [ "ne", "ne de" ], [ "ya", "ya da" ], [ "gerek", "gerekse de" ] ];
export default [ [ "ne", "ne" ], [ "gerek", "gerek" ], [ "olsun", "olmasın" ] ];

0 comments on commit 9df7465

Please sign in to comment.