axyseo 2.1.21 → 2.1.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/scoring/assessments/index.js +0 -2
- package/build/cjs/scoring/assessments/index.js.map +1 -1
- package/build/cjs/scoring/assessments/readability/SentenceLengthInTextAssessment.js +3 -1
- package/build/cjs/scoring/assessments/readability/SentenceLengthInTextAssessment.js.map +1 -1
- package/build/cjs/scoring/assessors/seoAssessor.js +1 -2
- package/build/cjs/scoring/assessors/seoAssessor.js.map +1 -1
- package/build/esm/scoring/assessments/index.js +0 -2
- package/build/esm/scoring/assessments/index.js.map +1 -1
- package/build/esm/scoring/assessments/readability/SentenceLengthInTextAssessment.js +3 -1
- package/build/esm/scoring/assessments/readability/SentenceLengthInTextAssessment.js.map +1 -1
- package/build/esm/scoring/assessors/seoAssessor.js +1 -2
- package/build/esm/scoring/assessors/seoAssessor.js.map +1 -1
- package/package.json +1 -1
|
@@ -12,7 +12,6 @@ var _TransitionWordsAssessment = _interopRequireDefault(require("./readability/T
|
|
|
12
12
|
var _RelatedKeywordsAssessment = _interopRequireDefault(require("./readability/RelatedKeywordsAssessment"));
|
|
13
13
|
var _InternalLinksAssessment = _interopRequireDefault(require("./seo/InternalLinksAssessment"));
|
|
14
14
|
var _IntroductionKeywordAssessment = _interopRequireDefault(require("./seo/IntroductionKeywordAssessment"));
|
|
15
|
-
var _KeyphraseLengthAssessment = _interopRequireDefault(require("./seo/KeyphraseLengthAssessment"));
|
|
16
15
|
var _KeywordDensityAssessment = _interopRequireDefault(require("./seo/KeywordDensityAssessment"));
|
|
17
16
|
var _MetaDescriptionKeywordAssessment = _interopRequireDefault(require("./seo/MetaDescriptionKeywordAssessment"));
|
|
18
17
|
var _MetaDescriptionLengthAssessment = _interopRequireDefault(require("./seo/MetaDescriptionLengthAssessment"));
|
|
@@ -56,7 +55,6 @@ const seo = exports.seo = {
|
|
|
56
55
|
MetaTitleKeywordAssessment: _MetaTitleKeywordAssessment.default,
|
|
57
56
|
IntroductionKeywordAssessment: _IntroductionKeywordAssessment.default,
|
|
58
57
|
SingleTitleAssessment: _SingleTitleAssessment.default,
|
|
59
|
-
KeyphraseLengthAssessment: _KeyphraseLengthAssessment.default,
|
|
60
58
|
UrlLengthAssessment: _UrlLengthAssessment.default,
|
|
61
59
|
KeyphraseDensityAssessment: _KeywordDensityAssessment.default,
|
|
62
60
|
MetaDescriptionKeywordAssessment: _MetaDescriptionKeywordAssessment.default,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_TextLengthAssessment","_interopRequireDefault","require","_ParagraphTooLongAssessment","_SentenceBeginningsAssessment","_SentenceLengthInTextAssessment","_TransitionWordsAssessment","_RelatedKeywordsAssessment","_InternalLinksAssessment","_IntroductionKeywordAssessment","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_TextLengthAssessment","_interopRequireDefault","require","_ParagraphTooLongAssessment","_SentenceBeginningsAssessment","_SentenceLengthInTextAssessment","_TransitionWordsAssessment","_RelatedKeywordsAssessment","_InternalLinksAssessment","_IntroductionKeywordAssessment","_KeywordDensityAssessment","_MetaDescriptionKeywordAssessment","_MetaDescriptionLengthAssessment","_OutboundLinksAssessment","_PageTitleWidthAssessment","_SingleH1Assessment","_SubHeadingsKeywordAssessment","_UrlKeywordAssessment","_ImageCountAssessment","_KeyphraseAssessment","_SingleTitleAssessment","_UrlLengthAssessment","_NumberInMetaTitleAssessment","_TextImagesAssessment","_MetaTitleKeywordAssessment","_SchemaAssessment","_RelatedKeywordsDensityAssessment","_InvalidCharactersInUrl","_FAQsStructureDataAssessment","e","__esModule","default","readability","exports","ParagraphTooLongAssessment","SentenceBeginningsAssessment","SentenceLengthInTextAssessment","TransitionWordsAssessment","RelatedKeywordsAssessment","seo","ImageCountAssessment","NumberInMetaTitleAssessment","InternalLinksAssessment","TextImagesAssessment","MetaTitleKeywordAssessment","IntroductionKeywordAssessment","SingleTitleAssessment","UrlLengthAssessment","KeyphraseDensityAssessment","MetaDescriptionKeywordAssessment","MetaDescriptionLengthAssessment","OutboundLinksAssessment","PageTitleWidthAssessment","SingleH1Assessment","SubheadingsKeywordAssessment","TextLengthAssessment","SlugKeywordAssessment","KeyphraseAssessment","SchemaAssessment","RelatedKeywordsDensityAssessment","InvalidCharactersInUrl","FAQsStructureDataAssessment"],"sources":["../../../../src/scoring/assessments/index.js"],"sourcesContent":["// SEO assessments - import TextLengthAssessment first to avoid initialization errors.\nimport TextLengthAssessment from './seo/TextLengthAssessment';\n\n// Readability assessments.\nimport ParagraphTooLongAssessment from './readability/ParagraphTooLongAssessment';\nimport SentenceBeginningsAssessment from './readability/SentenceBeginningsAssessment';\nimport SentenceLengthInTextAssessment from './readability/SentenceLengthInTextAssessment';\nimport TransitionWordsAssessment from './readability/TransitionWordsAssessment';\nimport RelatedKeywordsAssessment from './readability/RelatedKeywordsAssessment';\n\n// SEO assessments.\nimport InternalLinksAssessment from './seo/InternalLinksAssessment';\nimport IntroductionKeywordAssessment from './seo/IntroductionKeywordAssessment';\nimport KeyphraseDensityAssessment from './seo/KeywordDensityAssessment';\nimport MetaDescriptionKeywordAssessment from './seo/MetaDescriptionKeywordAssessment';\nimport MetaDescriptionLengthAssessment from './seo/MetaDescriptionLengthAssessment';\nimport OutboundLinksAssessment from './seo/OutboundLinksAssessment';\nimport PageTitleWidthAssessment from './seo/PageTitleWidthAssessment';\nimport SingleH1Assessment from './seo/SingleH1Assessment';\nimport SubheadingsKeywordAssessment from './seo/SubHeadingsKeywordAssessment';\nimport SlugKeywordAssessment from './seo/UrlKeywordAssessment';\nimport ImageCountAssessment from './seo/ImageCountAssessment';\nimport KeyphraseAssessment from './seo/KeyphraseAssessment';\nimport SingleTitleAssessment from './seo/SingleTitleAssessment';\nimport UrlLengthAssessment from './seo/UrlLengthAssessment';\nimport NumberInMetaTitleAssessment from './seo/NumberInMetaTitleAssessment';\nimport TextImagesAssessment from './seo/TextImagesAssessment';\nimport MetaTitleKeywordAssessment from './seo/MetaTitleKeywordAssessment';\nimport SchemaAssessment from './seo/SchemaAssessment';\nimport RelatedKeywordsDensityAssessment from './seo/RelatedKeywordsDensityAssessment';\nimport InvalidCharactersInUrl from './seo/InvalidCharactersInUrl';\nimport FAQsStructureDataAssessment from './seo/FAQsStructureDataAssessment';\n\nconst readability = {\n ParagraphTooLongAssessment,\n SentenceBeginningsAssessment,\n SentenceLengthInTextAssessment,\n TransitionWordsAssessment,\n RelatedKeywordsAssessment\n};\n\n// We expose the deprecated assessments for backwards compatibility.\nconst seo = {\n ImageCountAssessment,\n NumberInMetaTitleAssessment,\n InternalLinksAssessment,\n TextImagesAssessment,\n MetaTitleKeywordAssessment,\n IntroductionKeywordAssessment,\n SingleTitleAssessment,\n UrlLengthAssessment,\n KeyphraseDensityAssessment,\n MetaDescriptionKeywordAssessment,\n MetaDescriptionLengthAssessment,\n OutboundLinksAssessment,\n PageTitleWidthAssessment,\n SingleH1Assessment,\n SubheadingsKeywordAssessment,\n TextLengthAssessment,\n SlugKeywordAssessment,\n KeyphraseAssessment,\n SchemaAssessment,\n RelatedKeywordsDensityAssessment,\n InvalidCharactersInUrl,\n FAQsStructureDataAssessment\n};\n\nexport {readability, seo};\n"],"mappings":";;;;;;AACA,IAAAA,qBAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,2BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,6BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,+BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,0BAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,0BAAA,GAAAN,sBAAA,CAAAC,OAAA;AAGA,IAAAM,wBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,8BAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,yBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,iCAAA,GAAAV,sBAAA,CA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M,GAAA,GAAG;EACVC,oBAAoB,EAApBA,6BAAoB;EACpBC,2BAA2B,EAA3BA,oCAA2B;EAC3BC,uBAAuB,EAAvBA,gCAAuB;EACvBC,oBAAoB,EAApBA,6BAAoB;EACpBC,0BAA0B,EAA1BA,mCAA0B;EAC1BC,6BAA6B,EAA7BA,sCAA6B;EAC7BC,qBAAqB,EAArBA,8BAAqB;EACrBC,mBAAmB,EAAnBA,4BAAmB;EACnBC,0BAA0B,EAA1BA,iCAA0B;EAC1BC,gCAAgC,EAAhCA,yCAAgC;EAChCC,+BAA+B,EAA/BA,wCAA+B;EAC/BC,uBAAuB,EAAvBA,gCAAuB;EACvBC,wBAAwB,EAAxBA,iCAAwB;EACxBC,kBAAkB,EAAlBA,2BAAkB;EAClBC,4BAA4B,EAA5BA,qCAA4B;EAC5BC,oBAAoB,EAApBA,6BAAoB;EACpBC,qBAAqB,EAArBA,6BAAqB;EACrBC,mBAAmB,EAAnBA,4BAAmB;EACnBC,gBAAgB,EAAhBA,yBAAgB;EAChBC,gCAAgC,EAAhCA,yCAAgC;EAChCC,sBAAsB,EAAtBA,+BAAsB;EACtBC,2BAA2B,EAA3BA;AACF,CAAC","ignoreList":[]}
|
|
@@ -64,6 +64,7 @@ class SentenceLengthInTextAssessment extends _assessment.default {
|
|
|
64
64
|
if (researcher.getConfig('sentenceLength')) {
|
|
65
65
|
this._config = this.getLanguageSpecificConfig(researcher);
|
|
66
66
|
}
|
|
67
|
+
console.log('sentences', sentences);
|
|
67
68
|
const percentage = this.calculatePercentage(sentences);
|
|
68
69
|
const result = this.calculateResult(percentage, hasDescription);
|
|
69
70
|
const assessmentResult = new _AssessmentResult.default({
|
|
@@ -111,6 +112,7 @@ class SentenceLengthInTextAssessment extends _assessment.default {
|
|
|
111
112
|
let percentage = 0;
|
|
112
113
|
if (sentences.length !== 0) {
|
|
113
114
|
const tooLongTotal = this.countTooLongSentences(sentences);
|
|
115
|
+
console.log('tooLongTotal', tooLongTotal);
|
|
114
116
|
percentage = (0, _formatNumber.default)(tooLongTotal / sentences.length * 100);
|
|
115
117
|
}
|
|
116
118
|
return percentage;
|
|
@@ -124,7 +126,7 @@ class SentenceLengthInTextAssessment extends _assessment.default {
|
|
|
124
126
|
*/
|
|
125
127
|
calculateResult(percentage, hasDescription) {
|
|
126
128
|
let status = 'bad';
|
|
127
|
-
if (percentage
|
|
129
|
+
if (percentage <= 0 && hasDescription && percentage <= this._config.recommendedLength) {
|
|
128
130
|
status = 'good';
|
|
129
131
|
}
|
|
130
132
|
const score = this.getScore(_analysis.MAIN_CONTENT_POINTS, status);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentenceLengthInTextAssessment.js","names":["_lodash","require","_assessment","_interopRequireDefault","_checkForTooLongSentences","_formatNumber","_AssessmentResult","_polarisIcons","_analysis","e","__esModule","default","SentenceLengthInTextAssessment","Assessment","constructor","config","isCornerstone","isProduct","defaultConfig","id","TEXT_SENTENCE_LENGTH_ID","priority","docUrl","ctaType","fixPosition","icon","TextBlockIcon","recommendedLength","slightlyTooMany","farTooMany","title","content","improve","bad","good","_config","merge","identifier","getResult","paper","researcher","sentences","getResearch","hasDescription","getConfig","getLanguageSpecificConfig","percentage","calculatePercentage","result","calculateResult","assessmentResult","AssessmentResult","setScore","score","setStatus","status","isApplicable","currentConfig","languageSpecificConfig","hasOwnProperty","length","tooLongTotal","countTooLongSentences","formatNumber","getScore","MAIN_CONTENT_POINTS","getTooLongSentences","_default","exports"],"sources":["../../../../../src/scoring/assessments/readability/SentenceLengthInTextAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport getTooLongSentences from '../../helpers/assessments/checkForTooLongSentences';\nimport formatNumber from '../../../helpers/formatNumber';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {TextBlockIcon} from '@shopify/polaris-icons';\nimport {MAIN_CONTENT_POINTS, TEXT_SENTENCE_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that will calculate the length of sentences in the text.\n */\nclass SentenceLengthInTextAssessment extends Assessment {\n /**\n\t * Sets the identifier and the config.\n\t *\n\t * @param {object} config\t\t\tThe scoring configuration that should be used.\n\t * @param {boolean} isCornerstone\tWhether cornerstone configuration should be used.\n\t * @param {boolean} isProduct\t\tWhether product configuration should be used.\n\n\t * @returns {void}\n\t */\n constructor(config = {}, isCornerstone = false, isProduct = false) {\n super();\n\n const defaultConfig = {\n id: TEXT_SENTENCE_LENGTH_ID,\n priority: 'high',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#sentence-length',\n ctaType: 'fix',\n fixPosition: 'sentenceLength',\n icon: TextBlockIcon,\n recommendedLength: 20,\n slightlyTooMany: 25,\n farTooMany: 30,\n title: 'Text Sentence Length',\n content: {\n improve: '',\n bad:\n 'Sentence too long. Keep sentence length less than 20 words to improve readability and flow.',\n good: 'Sentence length is optimized for readability, less than 20 words.'\n }\n };\n\n this._config = merge(defaultConfig, config);\n this.identifier = TEXT_SENTENCE_LENGTH_ID;\n }\n\n /**\n * Scores the percentage of sentences including more than the recommended number of words.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The Assessment result.\n */\n getResult({paper, researcher}) {\n const sentences = researcher.getResearch('countSentencesFromText');\n const hasDescription = paper.hasDescription();\n if (researcher.getConfig('sentenceLength')) {\n this._config = this.getLanguageSpecificConfig(researcher);\n }\n\n const percentage = this.calculatePercentage(sentences);\n const result = this.calculateResult(percentage, hasDescription);\n\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(result.score);\n assessmentResult.setStatus(result.status);\n\n return assessmentResult;\n }\n\n /**\n * Checks whether the paper has text.\n *\n * @param {Paper} paper The paper to use for the assessment.\n *\n * @returns {boolean} True when there is text.\n */\n isApplicable(paper) {\n return true;\n }\n\n /**\n * Check if there is language-specific config, and if so, overwrite the current config with it.\n *\n * @param {Researcher} researcher The researcher to use.\n *\n * @returns {Object} The config that should be used.\n */\n getLanguageSpecificConfig(researcher) {\n const currentConfig = this._config;\n const languageSpecificConfig = researcher.getConfig('sentenceLength');\n\n if (languageSpecificConfig.hasOwnProperty('recommendedLength')) {\n currentConfig.recommendedLength = languageSpecificConfig.recommendedLength;\n }\n\n return currentConfig;\n }\n\n /**\n * Calculates the percentage of sentences that are too long.\n *\n * @param {Array} sentences The sentences to calculate the percentage for.\n * @returns {number} The calculates percentage of too long sentences.\n */\n calculatePercentage(sentences) {\n let percentage = 0;\n\n if (sentences.length !== 0) {\n const tooLongTotal = this.countTooLongSentences(sentences);\n\n percentage = formatNumber((tooLongTotal / sentences.length) * 100);\n }\n\n return percentage;\n }\n\n /**\n *\n * @param percentage\n * @param hasDescription\n * @returns {{score: number, status: string}}\n */\n calculateResult(percentage, hasDescription) {\n let status = 'bad';\n if (percentage > 0 && hasDescription && percentage <= this._config.recommendedLength) {\n status = 'good';\n }\n const score = this.getScore(MAIN_CONTENT_POINTS, status);\n\n this._config.content = {\n improve: '',\n bad: `Sentence too long. Keep sentence length less than ${this._config.recommendedLength} words to improve readability and flow.`,\n good: `Sentences optimized`\n };\n\n return {\n score,\n status\n };\n }\n\n /**\n * Gets the sentences that are qualified as being too long.\n *\n * @param {array} sentences The sentences to filter through.\n * @returns {array} Array with all the sentences considered to be too long.\n */\n getTooLongSentences(sentences) {\n return getTooLongSentences(sentences, this._config.recommendedLength);\n }\n\n /**\n * Get the total amount of sentences that are qualified as being too long.\n *\n * @param {Array} sentences The sentences to filter through.\n * @returns {Number} The amount of sentences that are considered too long.\n */\n countTooLongSentences(sentences) {\n return this.getTooLongSentences(sentences).length;\n }\n}\n\nexport default SentenceLengthInTextAssessment;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,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GAAI,GAAG,CAAC;IACpE;IAEA,OAAOd,UAAU;EACnB;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEG,eAAeA,CAACH,UAAU,EAAEH,cAAc,EAAE;IAC1C,IAAIY,MAAM,GAAG,KAAK;IAClB,IAAIT,UAAU,GAAG,CAAC,IAAIH,cAAc,IAAIG,UAAU,IAAI,IAAI,CAACX,OAAO,CAACR,iBAAiB,EAAE;MACpF4B,MAAM,GAAG,MAAM;IACjB;IACA,MAAMF,KAAK,GAAG,IAAI,CAACW,QAAQ,CAACC,6BAAmB,EAAEV,MAAM,CAAC;IAExD,IAAI,CAACpB,OAAO,CAACJ,OAAO,GAAG;MACrBC,OAAO,EAAE,EAAE;MACXC,GAAG,EAAE,qDAAqD,IAAI,CAACE,OAAO,CAACR,iBAAiB,yCAAyC;MACjIO,IAAI,EAAE;IACR,CAAC;IAED,OAAO;MACLmB,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEW,mBAAmBA,CAACzB,SAAS,EAAE;IAC7B,OAAO,IAAAyB,iCAAmB,EAACzB,SAAS,EAAE,IAAI,CAACN,OAAO,CAACR,iBAAiB,CAAC;EACvE;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEmC,qBAAqBA,CAACrB,SAAS,EAAE;IAC/B,OAAO,IAAI,CAACyB,mBAAmB,CAACzB,SAAS,CAAC,CAACmB,MAAM;EACnD;AACF;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAAzD,OAAA,GAEcC,8BAA8B","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"SentenceLengthInTextAssessment.js","names":["_lodash","require","_assessment","_interopRequireDefault","_checkForTooLongSentences","_formatNumber","_AssessmentResult","_polarisIcons","_analysis","e","__esModule","default","SentenceLengthInTextAssessment","Assessment","constructor","config","isCornerstone","isProduct","defaultConfig","id","TEXT_SENTENCE_LENGTH_ID","priority","docUrl","ctaType","fixPosition","icon","TextBlockIcon","recommendedLength","slightlyTooMany","farTooMany","title","content","improve","bad","good","_config","merge","identifier","getResult","paper","researcher","sentences","getResearch","hasDescription","getConfig","getLanguageSpecificConfig","console","log","percentage","calculatePercentage","result","calculateResult","assessmentResult","AssessmentResult","setScore","score","setStatus","status","isApplicable","currentConfig","languageSpecificConfig","hasOwnProperty","length","tooLongTotal","countTooLongSentences","formatNumber","getScore","MAIN_CONTENT_POINTS","getTooLongSentences","_default","exports"],"sources":["../../../../../src/scoring/assessments/readability/SentenceLengthInTextAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport getTooLongSentences from '../../helpers/assessments/checkForTooLongSentences';\nimport formatNumber from '../../../helpers/formatNumber';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {TextBlockIcon} from '@shopify/polaris-icons';\nimport {MAIN_CONTENT_POINTS, TEXT_SENTENCE_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that will calculate the length of sentences in the text.\n */\nclass SentenceLengthInTextAssessment extends Assessment {\n /**\n\t * Sets the identifier and the config.\n\t *\n\t * @param {object} config\t\t\tThe scoring configuration that should be used.\n\t * @param {boolean} isCornerstone\tWhether cornerstone configuration should be used.\n\t * @param {boolean} isProduct\t\tWhether product configuration should be used.\n\n\t * @returns {void}\n\t */\n constructor(config = {}, isCornerstone = false, isProduct = false) {\n super();\n\n const defaultConfig = {\n id: TEXT_SENTENCE_LENGTH_ID,\n priority: 'high',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#sentence-length',\n ctaType: 'fix',\n fixPosition: 'sentenceLength',\n icon: TextBlockIcon,\n recommendedLength: 20,\n slightlyTooMany: 25,\n farTooMany: 30,\n title: 'Text Sentence Length',\n content: {\n improve: '',\n bad:\n 'Sentence too long. Keep sentence length less than 20 words to improve readability and flow.',\n good: 'Sentence length is optimized for readability, less than 20 words.'\n }\n };\n\n this._config = merge(defaultConfig, config);\n this.identifier = TEXT_SENTENCE_LENGTH_ID;\n }\n\n /**\n * Scores the percentage of sentences including more than the recommended number of words.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The Assessment result.\n */\n getResult({paper, researcher}) {\n const sentences = researcher.getResearch('countSentencesFromText');\n const hasDescription = paper.hasDescription();\n if (researcher.getConfig('sentenceLength')) {\n this._config = this.getLanguageSpecificConfig(researcher);\n }\n console.log('sentences', sentences);\n const percentage = this.calculatePercentage(sentences);\n const result = this.calculateResult(percentage, hasDescription);\n\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(result.score);\n assessmentResult.setStatus(result.status);\n\n return assessmentResult;\n }\n\n /**\n * Checks whether the paper has text.\n *\n * @param {Paper} paper The paper to use for the assessment.\n *\n * @returns {boolean} True when there is text.\n */\n isApplicable(paper) {\n return true;\n }\n\n /**\n * Check if there is language-specific config, and if so, overwrite the current config with it.\n *\n * @param {Researcher} researcher The researcher to use.\n *\n * @returns {Object} The config that should be used.\n */\n getLanguageSpecificConfig(researcher) {\n const currentConfig = this._config;\n const languageSpecificConfig = researcher.getConfig('sentenceLength');\n\n if (languageSpecificConfig.hasOwnProperty('recommendedLength')) {\n currentConfig.recommendedLength = languageSpecificConfig.recommendedLength;\n }\n\n return currentConfig;\n }\n\n /**\n * Calculates the percentage of sentences that are too long.\n *\n * @param {Array} sentences The sentences to calculate the percentage for.\n * @returns {number} The calculates percentage of too long sentences.\n */\n calculatePercentage(sentences) {\n let percentage = 0;\n\n if (sentences.length !== 0) {\n const tooLongTotal = this.countTooLongSentences(sentences);\n console.log('tooLongTotal', tooLongTotal);\n percentage = formatNumber((tooLongTotal / sentences.length) * 100);\n }\n\n return percentage;\n }\n\n /**\n *\n * @param percentage\n * @param hasDescription\n * @returns {{score: number, status: string}}\n */\n calculateResult(percentage, hasDescription) {\n let status = 'bad';\n if (percentage <= 0 && hasDescription && percentage <= this._config.recommendedLength) {\n status = 'good';\n }\n const score = this.getScore(MAIN_CONTENT_POINTS, status);\n\n this._config.content = {\n improve: '',\n bad: `Sentence too long. Keep sentence length less than ${this._config.recommendedLength} words to improve readability and flow.`,\n good: `Sentences optimized`\n };\n\n return {\n score,\n status\n };\n }\n\n /**\n * Gets the sentences that are qualified as being too long.\n *\n * @param {array} sentences The sentences to filter through.\n * @returns {array} Array with all the sentences considered to be too long.\n */\n getTooLongSentences(sentences) {\n return getTooLongSentences(sentences, this._config.recommendedLength);\n }\n\n /**\n * Get the total amount of sentences that are qualified as being too long.\n *\n * @param {Array} sentences The sentences to filter through.\n * @returns {Number} The amount of sentences that are considered too long.\n */\n countTooLongSentences(sentences) {\n return this.getTooLongSentences(sentences).length;\n }\n}\n\nexport default SentenceLengthInTextAssessment;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,yBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,aAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,iBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,SAAA,GAAAP,OAAA;AAAoF,SAAAE,uBAAAM,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEpF;AACA;AACA;AACA,MAAMG,8BAA8B,SAASC,mBAAU,CAAC;EACtD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAEC,aAAa,GAAG,KAAK,EAAEC,SAAS,GAAG,KAAK,EAAE;IACjE,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEC,iCAAuB;MAC3BC,QAAQ,EAAE,MAAM;MAChBC,MAAM,EACJ,6FAA6F;MAC/FC,OAAO,EAAE,KAAK;MACdC,WA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yCAAyC;MACjIO,IAAI,EAAE;IACR,CAAC;IAED,OAAO;MACLqB,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEW,mBAAmBA,CAAC3B,SAAS,EAAE;IAC7B,OAAO,IAAA2B,iCAAmB,EAAC3B,SAAS,EAAE,IAAI,CAACN,OAAO,CAACR,iBAAiB,CAAC;EACvE;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEqC,qBAAqBA,CAACvB,SAAS,EAAE;IAC/B,OAAO,IAAI,CAAC2B,mBAAmB,CAAC3B,SAAS,CAAC,CAACqB,MAAM;EACnD;AACF;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAA3D,OAAA,GAEcC,8BAA8B","ignoreList":[]}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _assessor = _interopRequireDefault(require("./assessor"));
|
|
8
8
|
var _IntroductionKeywordAssessment = _interopRequireDefault(require("../assessments/seo/IntroductionKeywordAssessment"));
|
|
9
|
-
var _KeyphraseLengthAssessment = _interopRequireDefault(require("../assessments/seo/KeyphraseLengthAssessment"));
|
|
10
9
|
var _MetaDescriptionKeywordAssessment = _interopRequireDefault(require("../assessments/seo/MetaDescriptionKeywordAssessment"));
|
|
11
10
|
var _MetaDescriptionLengthAssessment = _interopRequireDefault(require("../assessments/seo/MetaDescriptionLengthAssessment"));
|
|
12
11
|
var _SubHeadingsKeywordAssessment = _interopRequireDefault(require("../assessments/seo/SubHeadingsKeywordAssessment"));
|
|
@@ -43,7 +42,7 @@ class SEOAssessor extends _assessor.default {
|
|
|
43
42
|
constructor(researcher, config) {
|
|
44
43
|
super(researcher, config);
|
|
45
44
|
this.type = 'SEOAssessor';
|
|
46
|
-
this._assessments = [new _MetaTitleKeywordAssessment.default(config?.titleKeyword), new _TextImagesAssessment.default(config?.textImages), new _NumberInMetaTitleAssessment.default(config?.numberTitle), new _IntroductionKeywordAssessment.default(config?.introductionKeyword), new
|
|
45
|
+
this._assessments = [new _MetaTitleKeywordAssessment.default(config?.titleKeyword), new _TextImagesAssessment.default(config?.textImages), new _NumberInMetaTitleAssessment.default(config?.numberTitle), new _IntroductionKeywordAssessment.default(config?.introductionKeyword), new _MetaDescriptionKeywordAssessment.default(config?.metaDescriptionKeyword), new _MetaDescriptionLengthAssessment.default(config?.metaDescriptionLength), new _SubHeadingsKeywordAssessment.default(config?.subheadingsKeyword), new _OutboundLinksAssessment.default(config?.externalLinks), new _KeywordDensityAssessment.default(config?.keyphraseDensity), new _ImageCountAssessment.default(config?.media), new _UrlLengthAssessment.default(config?.urlLength), new _SingleTitleAssessment.default(config?.singleTitle), new _KeyphraseAssessment.default(config?.keyphrase), new _InternalLinksAssessment.default(config?.internalLinks), new _PageTitleWidthAssessment.default(config?.titleWidth), new _UrlKeywordAssessment.default(config?.slugKeyword), new _SingleH1Assessment.default(config?.singleH1), new _SchemaAssessment.default(config?.schema), new _FAQsAssessment.default(config?.faqs), new _KeywordFAQsAssessment.default(config?.keywordFaqs), new _FAQsStructureDataAssessment.default(config?.faqsStructuredData), new _InvalidCharactersInUrl.default(config?.charactersUrl), new _RelatedKeywordsDensityAssessment.default(config?.relatedKeywordsDensity), new _TextLengthAssessment.default(config?.textLength)];
|
|
47
46
|
}
|
|
48
47
|
}
|
|
49
48
|
exports.default = SEOAssessor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seoAssessor.js","names":["_assessor","_interopRequireDefault","require","_IntroductionKeywordAssessment","
|
|
1
|
+
{"version":3,"file":"seoAssessor.js","names":["_assessor","_interopRequireDefault","require","_IntroductionKeywordAssessment","_MetaDescriptionKeywordAssessment","_MetaDescriptionLengthAssessment","_SubHeadingsKeywordAssessment","_OutboundLinksAssessment","_KeywordDensityAssessment","_InternalLinksAssessment","_UrlKeywordAssessment","_ImageCountAssessment","_PageTitleWidthAssessment","_SingleH1Assessment","_KeyphraseAssessment","_SingleTitleAssessment","_UrlLengthAssessment","_NumberInMetaTitleAssessment","_TextImagesAssessment","_TextLengthAssessment","_MetaTitleKeywordAssessment","_SchemaAssessment","_FAQsAssessment","_KeywordFAQsAssessment","_InvalidCharactersInUrl","_FAQsStructureDataAssessment","_RelatedKeywordsDensityAssessment","e","__esModule","default","SEOAssessor","Assessor","constructor","researcher","config","type","_assessments","MetaTitleKeywordAssessment","titleKeyword","TextImagesAssessment","textImages","NumberInMetaTitleAssessment","numberTitle","IntroductionKeywordAssessment","introductionKeyword","MetaDescriptionKeywordAssessment","metaDescriptionKeyword","MetaDescriptionLength","metaDescriptionLength","SubheadingsKeyword","subheadingsKeyword","OutboundLinks","externalLinks","KeyphraseDensityAssessment","keyphraseDensity","ImageCount","media","UrlLengthAssessment","urlLength","SingleTitleAssessment","singleTitle","KeyphraseAssessment","keyphrase","InternalLinksAssessment","internalLinks","TitleWidth","titleWidth","SlugKeywordAssessment","slugKeyword","SingleH1Assessment","singleH1","SchemaAssessment","schema","FAQsAssessment","faqs","KeywordFAQsAssessment","keywordFaqs","FAQsStructureDataAssessment","faqsStructuredData","InvalidCharactersInUrl","charactersUrl","RelatedKeywordsDensityAssessment","relatedKeywordsDensity","TextLengthAssessment","textLength","exports"],"sources":["../../../../src/scoring/assessors/seoAssessor.js"],"sourcesContent":["import Assessor from './assessor';\nimport IntroductionKeywordAssessment from '../assessments/seo/IntroductionKeywordAssessment';\nimport MetaDescriptionKeywordAssessment from '../assessments/seo/MetaDescriptionKeywordAssessment';\nimport MetaDescriptionLength from '../assessments/seo/MetaDescriptionLengthAssessment';\nimport SubheadingsKeyword from '../assessments/seo/SubHeadingsKeywordAssessment';\nimport OutboundLinks from '../assessments/seo/OutboundLinksAssessment';\nimport KeyphraseDensityAssessment from '../assessments/seo/KeywordDensityAssessment';\nimport InternalLinksAssessment from '../assessments/seo/InternalLinksAssessment';\nimport SlugKeywordAssessment from '../assessments/seo/UrlKeywordAssessment';\nimport ImageCount from '../assessments/seo/ImageCountAssessment';\nimport TitleWidth from '../assessments/seo/PageTitleWidthAssessment';\nimport SingleH1Assessment from '../assessments/seo/SingleH1Assessment';\nimport KeyphraseAssessment from '../assessments/seo/KeyphraseAssessment';\nimport SingleTitleAssessment from '../assessments/seo/SingleTitleAssessment';\nimport UrlLengthAssessment from '../assessments/seo/UrlLengthAssessment';\nimport NumberInMetaTitleAssessment from '../assessments/seo/NumberInMetaTitleAssessment';\nimport TextImagesAssessment from '../assessments/seo/TextImagesAssessment';\nimport TextLengthAssessment from '../assessments/seo/TextLengthAssessment';\nimport MetaTitleKeywordAssessment from '../assessments/seo/MetaTitleKeywordAssessment';\nimport SchemaAssessment from '@axyseo/scoring/assessments/seo/SchemaAssessment';\nimport FAQsAssessment from '../assessments/seo/FAQsAssessment';\nimport KeywordFAQsAssessment from '../assessments/seo/KeywordFAQsAssessment';\nimport InvalidCharactersInUrl from '../assessments/seo/InvalidCharactersInUrl';\nimport FAQsStructureDataAssessment from '@axyseo/scoring/assessments/seo/FAQsStructureDataAssessment';\nimport RelatedKeywordsDensityAssessment from '@axyseo/scoring/assessments/seo/RelatedKeywordsDensityAssessment';\n\n/**\n * The SEOAssessor class is used for the general SEO analysis.\n */\nexport default class SEOAssessor extends Assessor {\n /**\n * Creates a new SEOAssessor instance.\n * @param {Researcher}\tresearcher\tThe researcher to use.\n * @param {Object}\t\t[config]\tThe assessor config.\n */\n constructor(researcher, config) {\n super(researcher, config);\n this.type = 'SEOAssessor';\n\n this._assessments = [\n new MetaTitleKeywordAssessment(config?.titleKeyword),\n new TextImagesAssessment(config?.textImages),\n new NumberInMetaTitleAssessment(config?.numberTitle),\n new IntroductionKeywordAssessment(config?.introductionKeyword),\n new MetaDescriptionKeywordAssessment(config?.metaDescriptionKeyword),\n new MetaDescriptionLength(config?.metaDescriptionLength),\n new SubheadingsKeyword(config?.subheadingsKeyword),\n new OutboundLinks(config?.externalLinks),\n new KeyphraseDensityAssessment(config?.keyphraseDensity),\n new ImageCount(config?.media),\n new UrlLengthAssessment(config?.urlLength),\n new SingleTitleAssessment(config?.singleTitle),\n new KeyphraseAssessment(config?.keyphrase),\n new InternalLinksAssessment(config?.internalLinks),\n new TitleWidth(config?.titleWidth),\n new SlugKeywordAssessment(config?.slugKeyword),\n new SingleH1Assessment(config?.singleH1),\n new SchemaAssessment(config?.schema),\n new FAQsAssessment(config?.faqs),\n new KeywordFAQsAssessment(config?.keywordFaqs),\n new FAQsStructureDataAssessment(config?.faqsStructuredData),\n new InvalidCharactersInUrl(config?.charactersUrl),\n new RelatedKeywordsDensityAssessment(config?.relatedKeywordsDensity),\n new TextLengthAssessment(config?.textLength),\n ];\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,iCAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,gCAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,6BAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,wBAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,yBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,wBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,qBAAA,GAAAT,sBAAA,CAAAC,OAAA;AACA,IAAAS,qBAAA,GAAAV,sBAAA,CAAAC,OAAA;AACA,IAAAU,yBAAA,GAAAX,sBAAA,CAAAC,OAAA;AACA,IAAAW,mBAAA,GAAAZ,sBAAA,CAAAC,OAAA;AACA,IAAAY,oBAAA,GAAAb,sBAAA,CAAAC,OAAA;AACA,IAAAa,sBAAA,GAAAd,sBAAA,CAAAC,OAAA;AACA,IAAAc,oBAAA,GAAAf,sBAAA,CAAAC,OAAA;AACA,IAAAe,4BAAA,GAAAhB,sBAAA,CAAAC,OAAA;AACA,IAAAgB,qBAAA,GAAAjB,sBAAA,CAAAC,OAAA;AACA,IAAAiB,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C,6BAAU,CAACrB,MAAM,EAAEsB,KAAK,CAAC,EAC7B,IAAIC,4BAAmB,CAACvB,MAAM,EAAEwB,SAAS,CAAC,EAC1C,IAAIC,8BAAqB,CAACzB,MAAM,EAAE0B,WAAW,CAAC,EAC9C,IAAIC,4BAAmB,CAAC3B,MAAM,EAAE4B,SAAS,CAAC,EAC1C,IAAIC,gCAAuB,CAAC7B,MAAM,EAAE8B,aAAa,CAAC,EAClD,IAAIC,iCAAU,CAAC/B,MAAM,EAAEgC,UAAU,CAAC,EAClC,IAAIC,6BAAqB,CAACjC,MAAM,EAAEkC,WAAW,CAAC,EAC9C,IAAIC,2BAAkB,CAACnC,MAAM,EAAEoC,QAAQ,CAAC,EACxC,IAAIC,yBAAgB,CAACrC,MAAM,EAAEsC,MAAM,CAAC,EACpC,IAAIC,uBAAc,CAACvC,MAAM,EAAEwC,IAAI,CAAC,EAChC,IAAIC,8BAAqB,CAACzC,MAAM,EAAE0C,WAAW,CAAC,EAC9C,IAAIC,oCAA2B,CAAC3C,MAAM,EAAE4C,kBAAkB,CAAC,EAC3D,IAAIC,+BAAsB,CAAC7C,MAAM,EAAE8C,aAAa,CAAC,EACjD,IAAIC,yCAAgC,CAAC/C,MAAM,EAAEgD,sBAAsB,CAAC,EACpE,IAAIC,6BAAoB,CAACjD,MAAM,EAAEkD,UAAU,CAAC,CAC7C;EACH;AACF;AAACC,OAAA,CAAAxD,OAAA,GAAAC,WAAA","ignoreList":[]}
|
|
@@ -11,7 +11,6 @@ import RelatedKeywordsAssessment from "./readability/RelatedKeywordsAssessment";
|
|
|
11
11
|
// SEO assessments.
|
|
12
12
|
import InternalLinksAssessment from "./seo/InternalLinksAssessment";
|
|
13
13
|
import IntroductionKeywordAssessment from "./seo/IntroductionKeywordAssessment";
|
|
14
|
-
import KeyphraseLengthAssessment from "./seo/KeyphraseLengthAssessment";
|
|
15
14
|
import KeyphraseDensityAssessment from "./seo/KeywordDensityAssessment";
|
|
16
15
|
import MetaDescriptionKeywordAssessment from "./seo/MetaDescriptionKeywordAssessment";
|
|
17
16
|
import MetaDescriptionLengthAssessment from "./seo/MetaDescriptionLengthAssessment";
|
|
@@ -48,7 +47,6 @@ const seo = {
|
|
|
48
47
|
MetaTitleKeywordAssessment,
|
|
49
48
|
IntroductionKeywordAssessment,
|
|
50
49
|
SingleTitleAssessment,
|
|
51
|
-
KeyphraseLengthAssessment,
|
|
52
50
|
UrlLengthAssessment,
|
|
53
51
|
KeyphraseDensityAssessment,
|
|
54
52
|
MetaDescriptionKeywordAssessment,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["TextLengthAssessment","ParagraphTooLongAssessment","SentenceBeginningsAssessment","SentenceLengthInTextAssessment","TransitionWordsAssessment","RelatedKeywordsAssessment","InternalLinksAssessment","IntroductionKeywordAssessment","
|
|
1
|
+
{"version":3,"file":"index.js","names":["TextLengthAssessment","ParagraphTooLongAssessment","SentenceBeginningsAssessment","SentenceLengthInTextAssessment","TransitionWordsAssessment","RelatedKeywordsAssessment","InternalLinksAssessment","IntroductionKeywordAssessment","KeyphraseDensityAssessment","MetaDescriptionKeywordAssessment","MetaDescriptionLengthAssessment","OutboundLinksAssessment","PageTitleWidthAssessment","SingleH1Assessment","SubheadingsKeywordAssessment","SlugKeywordAssessment","ImageCountAssessment","KeyphraseAssessment","SingleTitleAssessment","UrlLengthAssessment","NumberInMetaTitleAssessment","TextImagesAssessment","MetaTitleKeywordAssessment","SchemaAssessment","RelatedKeywordsDensityAssessment","InvalidCharactersInUrl","FAQsStructureDataAssessment","readability","seo"],"sources":["../../../../src/scoring/assessments/index.js"],"sourcesContent":["// SEO assessments - import TextLengthAssessment first to avoid initialization errors.\nimport TextLengthAssessment from './seo/TextLengthAssessment';\n\n// Readability assessments.\nimport ParagraphTooLongAssessment from './readability/ParagraphTooLongAssessment';\nimport SentenceBeginningsAssessment from './readability/SentenceBeginningsAssessment';\nimport SentenceLengthInTextAssessment from './readability/SentenceLengthInTextAssessment';\nimport TransitionWordsAssessment from './readability/TransitionWordsAssessment';\nimport RelatedKeywordsAssessment from './readability/RelatedKeywordsAssessment';\n\n// SEO assessments.\nimport InternalLinksAssessment from './seo/InternalLinksAssessment';\nimport IntroductionKeywordAssessment from './seo/IntroductionKeywordAssessment';\nimport KeyphraseDensityAssessment from './seo/KeywordDensityAssessment';\nimport MetaDescriptionKeywordAssessment from './seo/MetaDescriptionKeywordAssessment';\nimport MetaDescriptionLengthAssessment from './seo/MetaDescriptionLengthAssessment';\nimport OutboundLinksAssessment from './seo/OutboundLinksAssessment';\nimport PageTitleWidthAssessment from './seo/PageTitleWidthAssessment';\nimport SingleH1Assessment from './seo/SingleH1Assessment';\nimport SubheadingsKeywordAssessment from './seo/SubHeadingsKeywordAssessment';\nimport SlugKeywordAssessment from './seo/UrlKeywordAssessment';\nimport ImageCountAssessment from './seo/ImageCountAssessment';\nimport KeyphraseAssessment from './seo/KeyphraseAssessment';\nimport SingleTitleAssessment from './seo/SingleTitleAssessment';\nimport UrlLengthAssessment from './seo/UrlLengthAssessment';\nimport NumberInMetaTitleAssessment from './seo/NumberInMetaTitleAssessment';\nimport TextImagesAssessment from './seo/TextImagesAssessment';\nimport MetaTitleKeywordAssessment from './seo/MetaTitleKeywordAssessment';\nimport SchemaAssessment from './seo/SchemaAssessment';\nimport RelatedKeywordsDensityAssessment from './seo/RelatedKeywordsDensityAssessment';\nimport InvalidCharactersInUrl from './seo/InvalidCharactersInUrl';\nimport FAQsStructureDataAssessment from './seo/FAQsStructureDataAssessment';\n\nconst readability = {\n ParagraphTooLongAssessment,\n SentenceBeginningsAssessment,\n SentenceLengthInTextAssessment,\n TransitionWordsAssessment,\n RelatedKeywordsAssessment\n};\n\n// We expose the deprecated assessments for backwards compatibility.\nconst seo = {\n ImageCountAssessment,\n NumberInMetaTitleAssessment,\n InternalLinksAssessment,\n TextImagesAssessment,\n MetaTitleKeywordAssessment,\n IntroductionKeywordAssessment,\n SingleTitleAssessment,\n UrlLengthAssessment,\n KeyphraseDensityAssessment,\n MetaDescriptionKeywordAssessment,\n MetaDescriptionLengthAssessment,\n OutboundLinksAssessment,\n PageTitleWidthAssessment,\n SingleH1Assessment,\n SubheadingsKeywordAssessment,\n TextLengthAssessment,\n SlugKeywordAssessment,\n KeyphraseAssessment,\n SchemaAssessment,\n RelatedKeywordsDensityAssessment,\n InvalidCharactersInUrl,\n FAQsStructureDataAssessment\n};\n\nexport {readability, seo};\n"],"mappings":"AAAA;AACA,OAAOA,oBAAoB;;AAE3B;AACA,OAAOC,0BAA0B;AACjC,OAAOC,4BAA4B;AACnC,OAAOC,8BAA8B;AACrC,OAAOC,yBAAyB;AAChC,OAAOC,yBAAyB;;AAEhC;AACA,OAAOC,uBAAuB;AAC9B,OAAOC,6BAA6B;AACpC,OAAOC,0BAA0B;AACjC,OAAOC,gCAAgC;AACvC,OAAOC,+BAA+B;AACtC,OAAOC,uBAAuB;AAC9B,OAAOC,wBAAwB;AAC/B,OAAOC,kBAAkB;AACzB,OAAOC,4BAA4B;AACnC,OAAOC,qBAAqB;AAC5B,OAAOC,oBAAoB;AAC3B,OAAOC,mBAAmB;AAC1B,OAAOC,qBAAqB;AAC5B,OAAOC,mBAAmB;AAC1B,OAAOC,2BAA2B;AAClC,OAAOC,oBAAoB;AAC3B,OAAOC,0BAA0B;AACjC,OAAOC,gBAAgB;AACvB,OAAOC,gCAAgC;AACvC,OAAOC,sBAAsB;AAC7B,OAAOC,2BAA2B;AAElC,MAAMC,WAAW,GAAG;EAClB1B,0BAA0B;EAC1BC,4BAA4B;EAC5BC,8BAA8B;EAC9BC,yBAAyB;EACzBC;AACF,CAAC;;AAED;AACA,MAAMuB,GAAG,GAAG;EACVZ,oBAAoB;EACpBI,2BAA2B;EAC3Bd,uBAAuB;EACvBe,oBAAoB;EACpBC,0BAA0B;EAC1Bf,6BAA6B;EAC7BW,qBAAqB;EACrBC,mBAAmB;EACnBX,0BAA0B;EAC1BC,gCAAgC;EAChCC,+BAA+B;EAC/BC,uBAAuB;EACvBC,wBAAwB;EACxBC,kBAAkB;EAClBC,4BAA4B;EAC5Bd,oBAAoB;EACpBe,qBAAqB;EACrBE,mBAAmB;EACnBM,gBAAgB;EAChBC,gCAAgC;EAChCC,sBAAsB;EACtBC;AACF,CAAC;AAED,SAAQC,WAAW,EAAEC,GAAG","ignoreList":[]}
|
|
@@ -58,6 +58,7 @@ class SentenceLengthInTextAssessment extends Assessment {
|
|
|
58
58
|
if (researcher.getConfig('sentenceLength')) {
|
|
59
59
|
this._config = this.getLanguageSpecificConfig(researcher);
|
|
60
60
|
}
|
|
61
|
+
console.log('sentences', sentences);
|
|
61
62
|
const percentage = this.calculatePercentage(sentences);
|
|
62
63
|
const result = this.calculateResult(percentage, hasDescription);
|
|
63
64
|
const assessmentResult = new AssessmentResult({
|
|
@@ -105,6 +106,7 @@ class SentenceLengthInTextAssessment extends Assessment {
|
|
|
105
106
|
let percentage = 0;
|
|
106
107
|
if (sentences.length !== 0) {
|
|
107
108
|
const tooLongTotal = this.countTooLongSentences(sentences);
|
|
109
|
+
console.log('tooLongTotal', tooLongTotal);
|
|
108
110
|
percentage = formatNumber(tooLongTotal / sentences.length * 100);
|
|
109
111
|
}
|
|
110
112
|
return percentage;
|
|
@@ -118,7 +120,7 @@ class SentenceLengthInTextAssessment extends Assessment {
|
|
|
118
120
|
*/
|
|
119
121
|
calculateResult(percentage, hasDescription) {
|
|
120
122
|
let status = 'bad';
|
|
121
|
-
if (percentage
|
|
123
|
+
if (percentage <= 0 && hasDescription && percentage <= this._config.recommendedLength) {
|
|
122
124
|
status = 'good';
|
|
123
125
|
}
|
|
124
126
|
const score = this.getScore(MAIN_CONTENT_POINTS, status);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SentenceLengthInTextAssessment.js","names":["merge","Assessment","getTooLongSentences","formatNumber","AssessmentResult","TextBlockIcon","MAIN_CONTENT_POINTS","TEXT_SENTENCE_LENGTH_ID","SentenceLengthInTextAssessment","constructor","config","isCornerstone","isProduct","defaultConfig","id","priority","docUrl","ctaType","fixPosition","icon","recommendedLength","slightlyTooMany","farTooMany","title","content","improve","bad","good","_config","identifier","getResult","paper","researcher","sentences","getResearch","hasDescription","getConfig","getLanguageSpecificConfig","percentage","calculatePercentage","result","calculateResult","assessmentResult","setScore","score","setStatus","status","isApplicable","currentConfig","languageSpecificConfig","hasOwnProperty","length","tooLongTotal","countTooLongSentences","getScore"],"sources":["../../../../../src/scoring/assessments/readability/SentenceLengthInTextAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport getTooLongSentences from '../../helpers/assessments/checkForTooLongSentences';\nimport formatNumber from '../../../helpers/formatNumber';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {TextBlockIcon} from '@shopify/polaris-icons';\nimport {MAIN_CONTENT_POINTS, TEXT_SENTENCE_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that will calculate the length of sentences in the text.\n */\nclass SentenceLengthInTextAssessment extends Assessment {\n /**\n\t * Sets the identifier and the config.\n\t *\n\t * @param {object} config\t\t\tThe scoring configuration that should be used.\n\t * @param {boolean} isCornerstone\tWhether cornerstone configuration should be used.\n\t * @param {boolean} isProduct\t\tWhether product configuration should be used.\n\n\t * @returns {void}\n\t */\n constructor(config = {}, isCornerstone = false, isProduct = false) {\n super();\n\n const defaultConfig = {\n id: TEXT_SENTENCE_LENGTH_ID,\n priority: 'high',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#sentence-length',\n ctaType: 'fix',\n fixPosition: 'sentenceLength',\n icon: TextBlockIcon,\n recommendedLength: 20,\n slightlyTooMany: 25,\n farTooMany: 30,\n title: 'Text Sentence Length',\n content: {\n improve: '',\n bad:\n 'Sentence too long. Keep sentence length less than 20 words to improve readability and flow.',\n good: 'Sentence length is optimized for readability, less than 20 words.'\n }\n };\n\n this._config = merge(defaultConfig, config);\n this.identifier = TEXT_SENTENCE_LENGTH_ID;\n }\n\n /**\n * Scores the percentage of sentences including more than the recommended number of words.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The Assessment result.\n */\n getResult({paper, researcher}) {\n const sentences = researcher.getResearch('countSentencesFromText');\n const hasDescription = paper.hasDescription();\n if (researcher.getConfig('sentenceLength')) {\n this._config = this.getLanguageSpecificConfig(researcher);\n }\n
|
|
1
|
+
{"version":3,"file":"SentenceLengthInTextAssessment.js","names":["merge","Assessment","getTooLongSentences","formatNumber","AssessmentResult","TextBlockIcon","MAIN_CONTENT_POINTS","TEXT_SENTENCE_LENGTH_ID","SentenceLengthInTextAssessment","constructor","config","isCornerstone","isProduct","defaultConfig","id","priority","docUrl","ctaType","fixPosition","icon","recommendedLength","slightlyTooMany","farTooMany","title","content","improve","bad","good","_config","identifier","getResult","paper","researcher","sentences","getResearch","hasDescription","getConfig","getLanguageSpecificConfig","console","log","percentage","calculatePercentage","result","calculateResult","assessmentResult","setScore","score","setStatus","status","isApplicable","currentConfig","languageSpecificConfig","hasOwnProperty","length","tooLongTotal","countTooLongSentences","getScore"],"sources":["../../../../../src/scoring/assessments/readability/SentenceLengthInTextAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport getTooLongSentences from '../../helpers/assessments/checkForTooLongSentences';\nimport formatNumber from '../../../helpers/formatNumber';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport {TextBlockIcon} from '@shopify/polaris-icons';\nimport {MAIN_CONTENT_POINTS, TEXT_SENTENCE_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents the assessment that will calculate the length of sentences in the text.\n */\nclass SentenceLengthInTextAssessment extends Assessment {\n /**\n\t * Sets the identifier and the config.\n\t *\n\t * @param {object} config\t\t\tThe scoring configuration that should be used.\n\t * @param {boolean} isCornerstone\tWhether cornerstone configuration should be used.\n\t * @param {boolean} isProduct\t\tWhether product configuration should be used.\n\n\t * @returns {void}\n\t */\n constructor(config = {}, isCornerstone = false, isProduct = false) {\n super();\n\n const defaultConfig = {\n id: TEXT_SENTENCE_LENGTH_ID,\n priority: 'high',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#sentence-length',\n ctaType: 'fix',\n fixPosition: 'sentenceLength',\n icon: TextBlockIcon,\n recommendedLength: 20,\n slightlyTooMany: 25,\n farTooMany: 30,\n title: 'Text Sentence Length',\n content: {\n improve: '',\n bad:\n 'Sentence too long. Keep sentence length less than 20 words to improve readability and flow.',\n good: 'Sentence length is optimized for readability, less than 20 words.'\n }\n };\n\n this._config = merge(defaultConfig, config);\n this.identifier = TEXT_SENTENCE_LENGTH_ID;\n }\n\n /**\n * Scores the percentage of sentences including more than the recommended number of words.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher used for calling research.\n *\n * @returns {AssessmentResult} The Assessment result.\n */\n getResult({paper, researcher}) {\n const sentences = researcher.getResearch('countSentencesFromText');\n const hasDescription = paper.hasDescription();\n if (researcher.getConfig('sentenceLength')) {\n this._config = this.getLanguageSpecificConfig(researcher);\n }\n console.log('sentences', sentences);\n const percentage = this.calculatePercentage(sentences);\n const result = this.calculateResult(percentage, hasDescription);\n\n const assessmentResult = new AssessmentResult({config: this._config});\n\n assessmentResult.setScore(result.score);\n assessmentResult.setStatus(result.status);\n\n return assessmentResult;\n }\n\n /**\n * Checks whether the paper has text.\n *\n * @param {Paper} paper The paper to use for the assessment.\n *\n * @returns {boolean} True when there is text.\n */\n isApplicable(paper) {\n return true;\n }\n\n /**\n * Check if there is language-specific config, and if so, overwrite the current config with it.\n *\n * @param {Researcher} researcher The researcher to use.\n *\n * @returns {Object} The config that should be used.\n */\n getLanguageSpecificConfig(researcher) {\n const currentConfig = this._config;\n const languageSpecificConfig = researcher.getConfig('sentenceLength');\n\n if (languageSpecificConfig.hasOwnProperty('recommendedLength')) {\n currentConfig.recommendedLength = languageSpecificConfig.recommendedLength;\n }\n\n return currentConfig;\n }\n\n /**\n * Calculates the percentage of sentences that are too long.\n *\n * @param {Array} sentences The sentences to calculate the percentage for.\n * @returns {number} The calculates percentage of too long sentences.\n */\n calculatePercentage(sentences) {\n let percentage = 0;\n\n if (sentences.length !== 0) {\n const tooLongTotal = this.countTooLongSentences(sentences);\n console.log('tooLongTotal', tooLongTotal);\n percentage = formatNumber((tooLongTotal / sentences.length) * 100);\n }\n\n return percentage;\n }\n\n /**\n *\n * @param percentage\n * @param hasDescription\n * @returns {{score: number, status: string}}\n */\n calculateResult(percentage, hasDescription) {\n let status = 'bad';\n if (percentage <= 0 && hasDescription && percentage <= this._config.recommendedLength) {\n status = 'good';\n }\n const score = this.getScore(MAIN_CONTENT_POINTS, status);\n\n this._config.content = {\n improve: '',\n bad: `Sentence too long. Keep sentence length less than ${this._config.recommendedLength} words to improve readability and flow.`,\n good: `Sentences optimized`\n };\n\n return {\n score,\n status\n };\n }\n\n /**\n * Gets the sentences that are qualified as being too long.\n *\n * @param {array} sentences The sentences to filter through.\n * @returns {array} Array with all the sentences considered to be too long.\n */\n getTooLongSentences(sentences) {\n return getTooLongSentences(sentences, this._config.recommendedLength);\n }\n\n /**\n * Get the total amount of sentences that are qualified as being too long.\n *\n * @param {Array} sentences The sentences to filter through.\n * @returns {Number} The amount of sentences that are considered too long.\n */\n countTooLongSentences(sentences) {\n return this.getTooLongSentences(sentences).length;\n }\n}\n\nexport default SentenceLengthInTextAssessment;\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,mBAAmB;AAC1B,OAAOC,YAAY;AACnB,OAAOC,gBAAgB;AACvB,SAAQC,aAAa,QAAO,wBAAwB;AACpD,SAAQC,mBAAmB,EAAEC,uBAAuB;;AAEpD;AACA;AACA;AACA,MAAMC,8BAA8B,SAASP,UAAU,CAAC;EACtD;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EAEEQ,WAAWA,CAACC,MAAM,GAAG,C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GAAG,MAAM;IACjB;IACA,MAAMF,KAAK,GAAG,IAAI,CAACU,QAAQ,CAAClD,mBAAmB,EAAE0C,MAAM,CAAC;IAExD,IAAI,CAACpB,OAAO,CAACJ,OAAO,GAAG;MACrBC,OAAO,EAAE,EAAE;MACXC,GAAG,EAAE,qDAAqD,IAAI,CAACE,OAAO,CAACR,iBAAiB,yCAAyC;MACjIO,IAAI,EAAE;IACR,CAAC;IAED,OAAO;MACLmB,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE9C,mBAAmBA,CAAC+B,SAAS,EAAE;IAC7B,OAAO/B,mBAAmB,CAAC+B,SAAS,EAAE,IAAI,CAACL,OAAO,CAACR,iBAAiB,CAAC;EACvE;;EAEA;AACF;AACA;AACA;AACA;AACA;EACEmC,qBAAqBA,CAACtB,SAAS,EAAE;IAC/B,OAAO,IAAI,CAAC/B,mBAAmB,CAAC+B,SAAS,CAAC,CAACoB,MAAM;EACnD;AACF;AAEA,eAAe7C,8BAA8B","ignoreList":[]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Assessor from "./assessor";
|
|
2
2
|
import IntroductionKeywordAssessment from "../assessments/seo/IntroductionKeywordAssessment";
|
|
3
|
-
import KeyphraseLengthAssessment from "../assessments/seo/KeyphraseLengthAssessment";
|
|
4
3
|
import MetaDescriptionKeywordAssessment from "../assessments/seo/MetaDescriptionKeywordAssessment";
|
|
5
4
|
import MetaDescriptionLength from "../assessments/seo/MetaDescriptionLengthAssessment";
|
|
6
5
|
import SubheadingsKeyword from "../assessments/seo/SubHeadingsKeywordAssessment";
|
|
@@ -37,7 +36,7 @@ export default class SEOAssessor extends Assessor {
|
|
|
37
36
|
constructor(researcher, config) {
|
|
38
37
|
super(researcher, config);
|
|
39
38
|
this.type = 'SEOAssessor';
|
|
40
|
-
this._assessments = [new MetaTitleKeywordAssessment(config?.titleKeyword), new TextImagesAssessment(config?.textImages), new NumberInMetaTitleAssessment(config?.numberTitle), new IntroductionKeywordAssessment(config?.introductionKeyword), new
|
|
39
|
+
this._assessments = [new MetaTitleKeywordAssessment(config?.titleKeyword), new TextImagesAssessment(config?.textImages), new NumberInMetaTitleAssessment(config?.numberTitle), new IntroductionKeywordAssessment(config?.introductionKeyword), new MetaDescriptionKeywordAssessment(config?.metaDescriptionKeyword), new MetaDescriptionLength(config?.metaDescriptionLength), new SubheadingsKeyword(config?.subheadingsKeyword), new OutboundLinks(config?.externalLinks), new KeyphraseDensityAssessment(config?.keyphraseDensity), new ImageCount(config?.media), new UrlLengthAssessment(config?.urlLength), new SingleTitleAssessment(config?.singleTitle), new KeyphraseAssessment(config?.keyphrase), new InternalLinksAssessment(config?.internalLinks), new TitleWidth(config?.titleWidth), new SlugKeywordAssessment(config?.slugKeyword), new SingleH1Assessment(config?.singleH1), new SchemaAssessment(config?.schema), new FAQsAssessment(config?.faqs), new KeywordFAQsAssessment(config?.keywordFaqs), new FAQsStructureDataAssessment(config?.faqsStructuredData), new InvalidCharactersInUrl(config?.charactersUrl), new RelatedKeywordsDensityAssessment(config?.relatedKeywordsDensity), new TextLengthAssessment(config?.textLength)];
|
|
41
40
|
}
|
|
42
41
|
}
|
|
43
42
|
//# sourceMappingURL=seoAssessor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"seoAssessor.js","names":["Assessor","IntroductionKeywordAssessment","
|
|
1
|
+
{"version":3,"file":"seoAssessor.js","names":["Assessor","IntroductionKeywordAssessment","MetaDescriptionKeywordAssessment","MetaDescriptionLength","SubheadingsKeyword","OutboundLinks","KeyphraseDensityAssessment","InternalLinksAssessment","SlugKeywordAssessment","ImageCount","TitleWidth","SingleH1Assessment","KeyphraseAssessment","SingleTitleAssessment","UrlLengthAssessment","NumberInMetaTitleAssessment","TextImagesAssessment","TextLengthAssessment","MetaTitleKeywordAssessment","SchemaAssessment","FAQsAssessment","KeywordFAQsAssessment","InvalidCharactersInUrl","FAQsStructureDataAssessment","RelatedKeywordsDensityAssessment","SEOAssessor","constructor","researcher","config","type","_assessments","titleKeyword","textImages","numberTitle","introductionKeyword","metaDescriptionKeyword","metaDescriptionLength","subheadingsKeyword","externalLinks","keyphraseDensity","media","urlLength","singleTitle","keyphrase","internalLinks","titleWidth","slugKeyword","singleH1","schema","faqs","keywordFaqs","faqsStructuredData","charactersUrl","relatedKeywordsDensity","textLength"],"sources":["../../../../src/scoring/assessors/seoAssessor.js"],"sourcesContent":["import Assessor from './assessor';\nimport IntroductionKeywordAssessment from '../assessments/seo/IntroductionKeywordAssessment';\nimport MetaDescriptionKeywordAssessment from '../assessments/seo/MetaDescriptionKeywordAssessment';\nimport MetaDescriptionLength from '../assessments/seo/MetaDescriptionLengthAssessment';\nimport SubheadingsKeyword from '../assessments/seo/SubHeadingsKeywordAssessment';\nimport OutboundLinks from '../assessments/seo/OutboundLinksAssessment';\nimport KeyphraseDensityAssessment from '../assessments/seo/KeywordDensityAssessment';\nimport InternalLinksAssessment from '../assessments/seo/InternalLinksAssessment';\nimport SlugKeywordAssessment from '../assessments/seo/UrlKeywordAssessment';\nimport ImageCount from '../assessments/seo/ImageCountAssessment';\nimport TitleWidth from '../assessments/seo/PageTitleWidthAssessment';\nimport SingleH1Assessment from '../assessments/seo/SingleH1Assessment';\nimport KeyphraseAssessment from '../assessments/seo/KeyphraseAssessment';\nimport SingleTitleAssessment from '../assessments/seo/SingleTitleAssessment';\nimport UrlLengthAssessment from '../assessments/seo/UrlLengthAssessment';\nimport NumberInMetaTitleAssessment from '../assessments/seo/NumberInMetaTitleAssessment';\nimport TextImagesAssessment from '../assessments/seo/TextImagesAssessment';\nimport TextLengthAssessment from '../assessments/seo/TextLengthAssessment';\nimport MetaTitleKeywordAssessment from '../assessments/seo/MetaTitleKeywordAssessment';\nimport SchemaAssessment from '@axyseo/scoring/assessments/seo/SchemaAssessment';\nimport FAQsAssessment from '../assessments/seo/FAQsAssessment';\nimport KeywordFAQsAssessment from '../assessments/seo/KeywordFAQsAssessment';\nimport InvalidCharactersInUrl from '../assessments/seo/InvalidCharactersInUrl';\nimport FAQsStructureDataAssessment from '@axyseo/scoring/assessments/seo/FAQsStructureDataAssessment';\nimport RelatedKeywordsDensityAssessment from '@axyseo/scoring/assessments/seo/RelatedKeywordsDensityAssessment';\n\n/**\n * The SEOAssessor class is used for the general SEO analysis.\n */\nexport default class SEOAssessor extends Assessor {\n /**\n * Creates a new SEOAssessor instance.\n * @param {Researcher}\tresearcher\tThe researcher to use.\n * @param {Object}\t\t[config]\tThe assessor config.\n */\n constructor(researcher, config) {\n super(researcher, config);\n this.type = 'SEOAssessor';\n\n this._assessments = [\n new MetaTitleKeywordAssessment(config?.titleKeyword),\n new TextImagesAssessment(config?.textImages),\n new NumberInMetaTitleAssessment(config?.numberTitle),\n new IntroductionKeywordAssessment(config?.introductionKeyword),\n new MetaDescriptionKeywordAssessment(config?.metaDescriptionKeyword),\n new MetaDescriptionLength(config?.metaDescriptionLength),\n new SubheadingsKeyword(config?.subheadingsKeyword),\n new OutboundLinks(config?.externalLinks),\n new KeyphraseDensityAssessment(config?.keyphraseDensity),\n new ImageCount(config?.media),\n new UrlLengthAssessment(config?.urlLength),\n new SingleTitleAssessment(config?.singleTitle),\n new KeyphraseAssessment(config?.keyphrase),\n new InternalLinksAssessment(config?.internalLinks),\n new TitleWidth(config?.titleWidth),\n new SlugKeywordAssessment(config?.slugKeyword),\n new SingleH1Assessment(config?.singleH1),\n new SchemaAssessment(config?.schema),\n new FAQsAssessment(config?.faqs),\n new KeywordFAQsAssessment(config?.keywordFaqs),\n new FAQsStructureDataAssessment(config?.faqsStructuredData),\n new InvalidCharactersInUrl(config?.charactersUrl),\n new RelatedKeywordsDensityAssessment(config?.relatedKeywordsDensity),\n new TextLengthAssessment(config?.textLength),\n ];\n }\n}\n"],"mappings":"AAAA,OAAOA,QAAQ;AACf,OAAOC,6BAA6B;AACpC,OAAOC,gCAAgC;AACvC,OAAOC,qBAAqB;AAC5B,OAAOC,kBAAkB;AACzB,OAAOC,aA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