axyseo 2.1.22 → 2.1.23

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.
@@ -64,7 +64,6 @@ 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);
68
67
  const percentage = this.calculatePercentage(sentences);
69
68
  const result = this.calculateResult(percentage, hasDescription);
70
69
  const assessmentResult = new _AssessmentResult.default({
@@ -112,7 +111,6 @@ class SentenceLengthInTextAssessment extends _assessment.default {
112
111
  let percentage = 0;
113
112
  if (sentences.length !== 0) {
114
113
  const tooLongTotal = this.countTooLongSentences(sentences);
115
- console.log('tooLongTotal', tooLongTotal);
116
114
  percentage = (0, _formatNumber.default)(tooLongTotal / sentences.length * 100);
117
115
  }
118
116
  return percentage;
@@ -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","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,WAAW,EAAE,gBAAgB;MAC7BC,IAAI,EAAEC,2BAAa;MACnBC,iBAAiB,EAAE,EAAE;MACrBC,eAAe,EAAE,EAAE;MACnBC,UAAU,EAAE,EAAE;MACdC,KAAK,EAAE,sBAAsB;MAC7BC,OAAO,EAAE;QACPC,OAAO,EAAE,EAAE;QACXC,GAAG,EACD,6FAA6F;QAC/FC,IAAI,EAAE;MACR;IACF,CAAC;IAED,IAAI,CAACC,OAAO,GAAG,IAAAC,aAAK,EAAClB,aAAa,EAAEH,MAAM,CAAC;IAC3C,IAAI,CAACsB,UAAU,GAAGjB,iCAAuB;EAC3C;;EAEA;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AACF;AAAC,IAAAO,QAAA,GAAAC,OAAA,CAAA3D,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","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 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 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;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AI,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":[]}
@@ -8,7 +8,6 @@ var _lodash = require("lodash");
8
8
  var _assessment = _interopRequireDefault(require("../assessment"));
9
9
  var _AssessmentResult = _interopRequireDefault(require("../../../values/AssessmentResult"));
10
10
  var _wordCountInText = _interopRequireDefault(require("../../../languageProcessing/researches/wordCountInText"));
11
- var _countCharacters = _interopRequireDefault(require("../../../languageProcessing/languages/ja/helpers/countCharacters"));
12
11
  var _analysis = require("../../../const/analysis");
13
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
13
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"TextLengthAssessment.js","names":["_lodash","require","_assessment","_interopRequireDefault","_AssessmentResult","_wordCountInText","_countCharacters","_analysis","e","__esModule","default","TextLengthAssessment","Assessment","constructor","config","defaultConfig","id","TEXT_LENGTH_ID","ctaType","docUrl","priority","fixPosition","title","content","good","bad","identifier","_config","merge","getResult","paper","researcher","calculatedResult","calculateResult","assessmentResult","AssessmentResult","setScore","score","setStatus","status","pageType","getPageType","count","wordCount","wordCountInText","rules","product","min","max","badMessage","collection","article","page","rule","getScore","MAIN_CONTENT_POINTS","isApplicable","_default","exports"],"sources":["../../../../../src/scoring/assessments/seo/TextLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport wordCountInText from '@axyseo/languageProcessing/researches/wordCountInText';\nimport countCharacters from '@axyseo/languageProcessing/languages/ja/helpers/countCharacters';\nimport {MAIN_CONTENT_POINTS, TEXT_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents an assessment that checks the length of the text and gives feedback accordingly.\n */\n class TextLengthAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: TEXT_LENGTH_ID,\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#text-length',\n priority: 'high',\n fixPosition: 'description',\n title: 'Content length ',\n content: {\n good: 'Content length on target',\n bad:\n 'Write 300 to 500 words. Cover features, specs, sizing, use, and care. '\n }\n };\n\n this.identifier = TEXT_LENGTH_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher}) {\n const calculatedResult = this.calculateResult(paper);\n const assessmentResult = new AssessmentResult({config: this._config});\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const pageType = paper.getPageType();\n const { count: wordCount } = wordCountInText(paper);\n\n const rules = {\n product: {\n min: 300,\n max: 500,\n badMessage:\n 'Write 300 to 500 words. Cover features, specs, sizing, use, and care.'\n },\n collection: {\n min: 150,\n max: 300,\n badMessage:\n 'Write 150 to 300 words. Present the range and give quick buying guidance.'\n },\n article: {\n min: 600,\n max: 1000,\n badMessage:\n 'Write 600 to 1000 words. Explain the topic with clear sections and examples.'\n },\n page: {\n min: 600,\n max: 1000,\n badMessage:\n 'Write 600 to 1000 words. Provide clear, well-structured info for the page’s purpose.'\n }\n };\n\n let status = 'good';\n const rule = rules[pageType];\n\n if (rule && (wordCount < rule.min || wordCount > rule.max)) {\n status = 'bad';\n this._config = merge(this._config, {\n content: {\n good: 'Content length on target',\n bad: rule.badMessage\n }\n });\n }\n\n return {\n score: this.getScore(MAIN_CONTENT_POINTS, status),\n status\n };\n }\n\n /**\n * Checks whether the paper has a keyword and a slug.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} True if the paper contains a keyword and a slug, and if the keywordCountInSlug research is available on the researcher.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n}\n\nexport default TextLengthAssessment;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,gBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,gBAAA,GAAAH,sBAAA,CAAAF,OAAA;AACA,IAAAM,SAAA,GAAAN,OAAA;AAA2E,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3E;AACA;AACA;AACC,MAAMG,oBAAoB,SAASC,mBAAU,CAAC;EAC7C;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IA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,GAAG,EAAE,GAAG;QACRC,GAAG,EAAE,IAAI;QACTC,UAAU,EACR;MACJ,CAAC;MACDG,IAAI,EAAE;QACJL,GAAG,EAAE,GAAG;QACRC,GAAG,EAAE,IAAI;QACTC,UAAU,EACR;MACJ;IACF,CAAC;IAED,IAAIV,MAAM,GAAG,MAAM;IACnB,MAAMc,IAAI,GAAGR,KAAK,CAACL,QAAQ,CAAC;IAE5B,IAAIa,IAAI,KAAKV,SAAS,GAAGU,IAAI,CAACN,GAAG,IAAIJ,SAAS,GAAGU,IAAI,CAACL,GAAG,CAAC,EAAE;MAC1DT,MAAM,GAAG,KAAK;MACd,IAAI,CAACZ,OAAO,GAAG,IAAAC,aAAK,EAAC,IAAI,CAACD,OAAO,EAAE;QACjCJ,OAAO,EAAE;UACPC,IAAI,EAAE,0BAA0B;UAChCC,GAAG,EAAE4B,IAAI,CAACJ;QACZ;MACF,CAAC,CAAC;IACJ;IAEA,OAAO;MACLZ,KAAK,EAAE,IAAI,CAACiB,QAAQ,CAACC,6BAAmB,EAAEhB,MAAM,CAAC;MACjDA;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEiB,YAAYA,CAAC1B,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF;AAAC,IAAA0B,QAAA,GAAAC,OAAA,CAAAhD,OAAA,GAEcC,oBAAoB","ignoreList":[]}
1
+ {"version":3,"file":"TextLengthAssessment.js","names":["_lodash","require","_assessment","_interopRequireDefault","_AssessmentResult","_wordCountInText","_analysis","e","__esModule","default","TextLengthAssessment","Assessment","constructor","config","defaultConfig","id","TEXT_LENGTH_ID","ctaType","docUrl","priority","fixPosition","title","content","good","bad","identifier","_config","merge","getResult","paper","researcher","calculatedResult","calculateResult","assessmentResult","AssessmentResult","setScore","score","setStatus","status","pageType","getPageType","count","wordCount","wordCountInText","rules","product","min","max","badMessage","collection","article","page","rule","getScore","MAIN_CONTENT_POINTS","isApplicable","_default","exports"],"sources":["../../../../../src/scoring/assessments/seo/TextLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport wordCountInText from '@axyseo/languageProcessing/researches/wordCountInText';\nimport {MAIN_CONTENT_POINTS, TEXT_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents an assessment that checks the length of the text and gives feedback accordingly.\n */\n class TextLengthAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: TEXT_LENGTH_ID,\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#text-length',\n priority: 'high',\n fixPosition: 'description',\n title: 'Content length ',\n content: {\n good: 'Content length on target',\n bad:\n 'Write 300 to 500 words. Cover features, specs, sizing, use, and care. '\n }\n };\n\n this.identifier = TEXT_LENGTH_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher}) {\n const calculatedResult = this.calculateResult(paper);\n const assessmentResult = new AssessmentResult({config: this._config});\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const pageType = paper.getPageType();\n const { count: wordCount } = wordCountInText(paper);\n\n const rules = {\n product: {\n min: 300,\n max: 500,\n badMessage:\n 'Write 300 to 500 words. Cover features, specs, sizing, use, and care.'\n },\n collection: {\n min: 150,\n max: 300,\n badMessage:\n 'Write 150 to 300 words. Present the range and give quick buying guidance.'\n },\n article: {\n min: 600,\n max: 1000,\n badMessage:\n 'Write 600 to 1000 words. Explain the topic with clear sections and examples.'\n },\n page: {\n min: 600,\n max: 1000,\n badMessage:\n 'Write 600 to 1000 words. Provide clear, well-structured info for the page’s purpose.'\n }\n };\n\n let status = 'good';\n const rule = rules[pageType];\n\n if (rule && (wordCount < rule.min || wordCount > rule.max)) {\n status = 'bad';\n this._config = merge(this._config, {\n content: {\n good: 'Content length on target',\n bad: rule.badMessage\n }\n });\n }\n\n return {\n score: this.getScore(MAIN_CONTENT_POINTS, status),\n status\n };\n }\n\n /**\n * Checks whether the paper has a keyword and a slug.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} True if the paper contains a keyword and a slug, and if the keywordCountInSlug research is available on the researcher.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n}\n\nexport default TextLengthAssessment;\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,gBAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,SAAA,GAAAL,OAAA;AAA2E,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAE3E;AACA;AACA;AACC,MAAMG,oBAAoB,SAASC,mBAAU,CAAC;EAC7C;AACF;AACA;AACA;AACA;AACA;AACA;EACEC,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEC,wBAAc;MAClBC,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,yFAAyF;MAC3FC,QAAQ,EAAE,MAAM;MAChBC,WAAW,EAAE,aAAa;MAC1BC,KAAK,EAAE,iBAAiB;MACxBC,OAAO,EAAE;QACPC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MAAMc,IAAI,GAAGR,KAAK,CAACL,QAAQ,CAAC;IAE5B,IAAIa,IAAI,KAAKV,SAAS,GAAGU,IAAI,CAACN,GAAG,IAAIJ,SAAS,GAAGU,IAAI,CAACL,GAAG,CAAC,EAAE;MAC1DT,MAAM,GAAG,KAAK;MACd,IAAI,CAACZ,OAAO,GAAG,IAAAC,aAAK,EAAC,IAAI,CAACD,OAAO,EAAE;QACjCJ,OAAO,EAAE;UACPC,IAAI,EAAE,0BAA0B;UAChCC,GAAG,EAAE4B,IAAI,CAACJ;QACZ;MACF,CAAC,CAAC;IACJ;IAEA,OAAO;MACLZ,KAAK,EAAE,IAAI,CAACiB,QAAQ,CAACC,6BAAmB,EAAEhB,MAAM,CAAC;MACjDA;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEiB,YAAYA,CAAC1B,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF;AAAC,IAAA0B,QAAA,GAAAC,OAAA,CAAAhD,OAAA,GAEcC,oBAAoB","ignoreList":[]}
@@ -58,7 +58,6 @@ class SentenceLengthInTextAssessment extends Assessment {
58
58
  if (researcher.getConfig('sentenceLength')) {
59
59
  this._config = this.getLanguageSpecificConfig(researcher);
60
60
  }
61
- console.log('sentences', sentences);
62
61
  const percentage = this.calculatePercentage(sentences);
63
62
  const result = this.calculateResult(percentage, hasDescription);
64
63
  const assessmentResult = new AssessmentResult({
@@ -106,7 +105,6 @@ class SentenceLengthInTextAssessment extends Assessment {
106
105
  let percentage = 0;
107
106
  if (sentences.length !== 0) {
108
107
  const tooLongTotal = this.countTooLongSentences(sentences);
109
- console.log('tooLongTotal', tooLongTotal);
110
108
  percentage = formatNumber(tooLongTotal / sentences.length * 100);
111
109
  }
112
110
  return percentage;
@@ -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","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,CAAC,CAAC,EAAEC,aAAa,GAAG,KAAK,EAAEC,SAAS,GAAG,KAAK,EAAE;IACjE,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEP,uBAAuB;MAC3BQ,QAAQ,EAAE,MAAM;MAChBC,MAAM,EACJ,6FAA6F;MAC/FC,OAAO,EAAE,KAAK;MACdC,WAAW,EAAE,gBAAgB;MAC7BC,IAAI,EAAEd,aAAa;MACnBe,iBAAiB,EAAE,EAAE;MACrBC,eAAe,EAAE,EAAE;MACnBC,UAAU,EAAE,EAAE;MACdC,KAAK,EAAE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;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
+ {"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 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 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,CAAC,CAAC,EAAEC,aAAa,GAAG,KAAK,EAAEC,SAAS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E;MACXC,GAAG,EAAE,qDAAqD,IAAI,CAACE,OAAO,CAACR,iBAAiB,yCAAyC;MACjIO,IAAI,EAAE;IACR,CAAC;IAED,OAAO;MACLiB,KAAK;MACLE;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;EACE5C,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;EACEiC,qBAAqBA,CAACpB,SAAS,EAAE;IAC/B,OAAO,IAAI,CAAC/B,mBAAmB,CAAC+B,SAAS,CAAC,CAACkB,MAAM;EACnD;AACF;AAEA,eAAe3C,8BAA8B","ignoreList":[]}
@@ -2,7 +2,6 @@ import { merge } from 'lodash';
2
2
  import Assessment from "../assessment";
3
3
  import AssessmentResult from "../../../values/AssessmentResult";
4
4
  import wordCountInText from "../../../languageProcessing/researches/wordCountInText";
5
- import countCharacters from "../../../languageProcessing/languages/ja/helpers/countCharacters";
6
5
  import { MAIN_CONTENT_POINTS, TEXT_LENGTH_ID } from "../../../const/analysis";
7
6
 
8
7
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"TextLengthAssessment.js","names":["merge","Assessment","AssessmentResult","wordCountInText","countCharacters","MAIN_CONTENT_POINTS","TEXT_LENGTH_ID","TextLengthAssessment","constructor","config","defaultConfig","id","ctaType","docUrl","priority","fixPosition","title","content","good","bad","identifier","_config","getResult","paper","researcher","calculatedResult","calculateResult","assessmentResult","setScore","score","setStatus","status","pageType","getPageType","count","wordCount","rules","product","min","max","badMessage","collection","article","page","rule","getScore","isApplicable"],"sources":["../../../../../src/scoring/assessments/seo/TextLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport wordCountInText from '@axyseo/languageProcessing/researches/wordCountInText';\nimport countCharacters from '@axyseo/languageProcessing/languages/ja/helpers/countCharacters';\nimport {MAIN_CONTENT_POINTS, TEXT_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents an assessment that checks the length of the text and gives feedback accordingly.\n */\n class TextLengthAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: TEXT_LENGTH_ID,\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#text-length',\n priority: 'high',\n fixPosition: 'description',\n title: 'Content length ',\n content: {\n good: 'Content length on target',\n bad:\n 'Write 300 to 500 words. Cover features, specs, sizing, use, and care. '\n }\n };\n\n this.identifier = TEXT_LENGTH_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher}) {\n const calculatedResult = this.calculateResult(paper);\n const assessmentResult = new AssessmentResult({config: this._config});\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const pageType = paper.getPageType();\n const { count: wordCount } = wordCountInText(paper);\n\n const rules = {\n product: {\n min: 300,\n max: 500,\n badMessage:\n 'Write 300 to 500 words. Cover features, specs, sizing, use, and care.'\n },\n collection: {\n min: 150,\n max: 300,\n badMessage:\n 'Write 150 to 300 words. Present the range and give quick buying guidance.'\n },\n article: {\n min: 600,\n max: 1000,\n badMessage:\n 'Write 600 to 1000 words. Explain the topic with clear sections and examples.'\n },\n page: {\n min: 600,\n max: 1000,\n badMessage:\n 'Write 600 to 1000 words. Provide clear, well-structured info for the page’s purpose.'\n }\n };\n\n let status = 'good';\n const rule = rules[pageType];\n\n if (rule && (wordCount < rule.min || wordCount > rule.max)) {\n status = 'bad';\n this._config = merge(this._config, {\n content: {\n good: 'Content length on target',\n bad: rule.badMessage\n }\n });\n }\n\n return {\n score: this.getScore(MAIN_CONTENT_POINTS, status),\n status\n };\n }\n\n /**\n * Checks whether the paper has a keyword and a slug.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} True if the paper contains a keyword and a slug, and if the keywordCountInSlug research is available on the researcher.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n}\n\nexport default TextLengthAssessment;\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,OAAOC,eAAe;AACtB,OAAOC,eAAe;AACtB,SAAQC,mBAAmB,EAAEC,cAAc;;AAE3C;AACA;AACA;AACC,MAAMC,oBAAoB,SAASN,UAAU,CAAC;EAC7C;AACF;AACA;AACA;AACA;AACA;AACA;EACEO,WAAWA,CAACC,MAAM,GAAG,CAAC,CAAC,EAAE;IACvB,KAAK,CAAC,CAAC;IAEP,MAAMC,aAAa,GAAG;MACpBC,EAAE,EAAEL,cAAc;MAClBM,OAAO,EAAE,KAAK;MACdC,MAAM,EACJ,yFAAyF;MAC3FC,QAAQ,EAAE,MAAM;MAChBC,WAAW,EAAE,aAAa;MAC1BC,KAAK,EAAE,iBAAiB;MACxBC,OAAO,EAAE;QACPC,IAAI,EAAE,0BAA0B;QAChCC,GAAG,EACD;MACJ;IACF,CAAC;IAED,IAAI,CAACC,UAAU,GAAGd,cAAc;IAChC,IAAI,CAACe,OAAO,GAAGrB,KAAK,CAACU,aAAa,EAAED,MAAM,CAAC;EAC7C;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEa,SAASA,CAAC;IAACC,KAAK;IAAEC;EAAU,CAAC,EAAE;IAC7B,MAAMC,gBAAgB,GAAG,IAAI,CAACC,eAAe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AAI,CAACJ;QACZ;MACF,CAAC,CAAC;IACJ;IAEA,OAAO;MACLX,KAAK,EAAE,IAAI,CAACgB,QAAQ,CAACxC,mBAAmB,EAAE0B,MAAM,CAAC;MACjDA;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEe,YAAYA,CAACvB,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF;AAEA,eAAejB,oBAAoB","ignoreList":[]}
1
+ {"version":3,"file":"TextLengthAssessment.js","names":["merge","Assessment","AssessmentResult","wordCountInText","MAIN_CONTENT_POINTS","TEXT_LENGTH_ID","TextLengthAssessment","constructor","config","defaultConfig","id","ctaType","docUrl","priority","fixPosition","title","content","good","bad","identifier","_config","getResult","paper","researcher","calculatedResult","calculateResult","assessmentResult","setScore","score","setStatus","status","pageType","getPageType","count","wordCount","rules","product","min","max","badMessage","collection","article","page","rule","getScore","isApplicable"],"sources":["../../../../../src/scoring/assessments/seo/TextLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport wordCountInText from '@axyseo/languageProcessing/researches/wordCountInText';\nimport {MAIN_CONTENT_POINTS, TEXT_LENGTH_ID} from '@axyseo/const/analysis';\n\n/**\n * Represents an assessment that checks the length of the text and gives feedback accordingly.\n */\n class TextLengthAssessment extends Assessment {\n /**\n * Sets the identifier and the config.\n *\n * @param {Object} [config] The configuration to use.\n *\n * @returns {void}\n */\n constructor(config = {}) {\n super();\n\n const defaultConfig = {\n id: TEXT_LENGTH_ID,\n ctaType: 'fix',\n docUrl:\n 'https://docs.avada.io/seo-suite-help-center/seo-audit/on-page-seo/checklist#text-length',\n priority: 'high',\n fixPosition: 'description',\n title: 'Content length ',\n content: {\n good: 'Content length on target',\n bad:\n 'Write 300 to 500 words. Cover features, specs, sizing, use, and care. '\n }\n };\n\n this.identifier = TEXT_LENGTH_ID;\n this._config = merge(defaultConfig, config);\n }\n\n /**\n * Executes the Assessment and returns a result.\n *\n * @param {Paper} paper The Paper object to assess.\n * @param {Researcher} researcher The Researcher object containing all available researches.\n *\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher}) {\n const calculatedResult = this.calculateResult(paper);\n const assessmentResult = new AssessmentResult({config: this._config});\n assessmentResult.setScore(calculatedResult.score);\n assessmentResult.setStatus(calculatedResult.status);\n\n return assessmentResult;\n }\n\n /**\n *\n * @param paper\n * @returns {{score: number, status: string}}\n */\n calculateResult(paper) {\n const pageType = paper.getPageType();\n const { count: wordCount } = wordCountInText(paper);\n\n const rules = {\n product: {\n min: 300,\n max: 500,\n badMessage:\n 'Write 300 to 500 words. Cover features, specs, sizing, use, and care.'\n },\n collection: {\n min: 150,\n max: 300,\n badMessage:\n 'Write 150 to 300 words. Present the range and give quick buying guidance.'\n },\n article: {\n min: 600,\n max: 1000,\n badMessage:\n 'Write 600 to 1000 words. Explain the topic with clear sections and examples.'\n },\n page: {\n min: 600,\n max: 1000,\n badMessage:\n 'Write 600 to 1000 words. Provide clear, well-structured info for the page’s purpose.'\n }\n };\n\n let status = 'good';\n const rule = rules[pageType];\n\n if (rule && (wordCount < rule.min || wordCount > rule.max)) {\n status = 'bad';\n this._config = merge(this._config, {\n content: {\n good: 'Content length on target',\n bad: rule.badMessage\n }\n });\n }\n\n return {\n score: this.getScore(MAIN_CONTENT_POINTS, status),\n status\n };\n }\n\n /**\n * Checks whether the paper has a keyword and a slug.\n *\n * @param {Paper} paper The paper to use for the assessment.\n * @param {Researcher} researcher The researcher object.\n *\n * @returns {boolean} True if the paper contains a keyword and a slug, and if the keywordCountInSlug research is available on the researcher.\n */\n isApplicable(paper, researcher) {\n return true;\n }\n}\n\nexport default TextLengthAssessment;\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AAC5B,OAAOC,UAAU;AACjB,OAAOC,gBAAgB;AACvB,OAAOC,eAAe;AACtB,SAAQC,mBAA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;QACRC,GAAG,EAAE,GAAG;QACRC,UAAU,EACR;MACJ,CAAC;MACDC,UAAU,EAAE;QACVH,GAAG,EAAE,GAAG;QACRC,GAAG,EAAE,GAAG;QACRC,UAAU,EACR;MACJ,CAAC;MACDE,OAAO,EAAE;QACPJ,GAAG,EAAE,GAAG;QACRC,GAAG,EAAE,IAAI;QACTC,UAAU,EACR;MACJ,CAAC;MACDG,IAAI,EAAE;QACJL,GAAG,EAAE,GAAG;QACRC,GAAG,EAAE,IAAI;QACTC,UAAU,EACR;MACJ;IACF,CAAC;IAED,IAAIT,MAAM,GAAG,MAAM;IACnB,MAAMa,IAAI,GAAGR,KAAK,CAACJ,QAAQ,CAAC;IAE5B,IAAIY,IAAI,KAAKT,SAAS,GAAGS,IAAI,CAACN,GAAG,IAAIH,SAAS,GAAGS,IAAI,CAACL,GAAG,CAAC,EAAE;MAC1DR,MAAM,GAAG,KAAK;MACd,IAAI,CAACV,OAAO,GAAGpB,KAAK,CAAC,IAAI,CAACoB,OAAO,EAAE;QACjCJ,OAAO,EAAE;UACPC,IAAI,EAAE,0BAA0B;UAChCC,GAAG,EAAEyB,IAAI,CAACJ;QACZ;MACF,CAAC,CAAC;IACJ;IAEA,OAAO;MACLX,KAAK,EAAE,IAAI,CAACgB,QAAQ,CAACxC,mBAAmB,EAAE0B,MAAM,CAAC;MACjDA;IACF,CAAC;EACH;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;EACEe,YAAYA,CAACvB,KAAK,EAAEC,UAAU,EAAE;IAC9B,OAAO,IAAI;EACb;AACF;AAEA,eAAejB,oBAAoB","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "axyseo",
3
- "version": "2.1.22",
3
+ "version": "2.1.23",
4
4
  "main": "build/cjs/index.js",
5
5
  "module": "build/esm/index.js",
6
6
  "exports": {