axyseo 2.0.0-alpha.0.0.54 → 2.0.0-alpha.0.0.55
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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { merge } from 'lodash';
|
|
2
2
|
import Assessment from "../assessment";
|
|
3
3
|
import AssessmentResult from "../../../values/AssessmentResult";
|
|
4
|
-
import
|
|
4
|
+
import countWords from "../../../languageProcessing/helpers/word/countWords";
|
|
5
|
+
import countCharacters from "../../../languageProcessing/languages/ja/helpers/countCharacters";
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Represents an assessment that checks the length of the text and gives feedback accordingly.
|
|
@@ -63,10 +64,8 @@ export default class TextLengthAssessment extends Assessment {
|
|
|
63
64
|
* @returns {{score: number, body: React.JSX.Element, status: string}}
|
|
64
65
|
*/
|
|
65
66
|
calculateResult(paper, i18n) {
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
charCount
|
|
69
|
-
} = countWordInHtml(paper.getText(), true);
|
|
67
|
+
const wordCount = countWords(paper.getText());
|
|
68
|
+
const charCount = countCharacters(paper.getText());
|
|
70
69
|
let status = 'bad';
|
|
71
70
|
if (charCount < 2500 && wordCount >= 600) {
|
|
72
71
|
status = 'improve';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextLengthAssessment.js","names":["merge","Assessment","AssessmentResult","
|
|
1
|
+
{"version":3,"file":"TextLengthAssessment.js","names":["merge","Assessment","AssessmentResult","countWords","countCharacters","TextLengthAssessment","constructor","config","defaultConfig","id","ctaType","docUrl","priority","fixPosition","title","content","good","improve","bad","identifier","_config","getResult","paper","researcher","i18n","calculatedResult","calculateResult","assessmentResult","setScore","score","setStatus","status","wordCount","getText","charCount","getScore"],"sources":["../../../../src/scoring/assessments/seo/TextLengthAssessment.js"],"sourcesContent":["import {merge} from 'lodash';\nimport Assessment from '../assessment';\nimport AssessmentResult from '../../../values/AssessmentResult';\nimport countWords from '@axyseo/languageProcessing/helpers/word/countWords';\nimport countCharacters from '@axyseo/languageProcessing/languages/ja/helpers/countCharacters';\n\n/**\n * Represents an assessment that checks the length of the text and gives feedback accordingly.\n */\nexport default 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: 'textLength',\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: 'Text length',\n content: {\n good: 'Text length is optimized.',\n improve:\n 'Content length is acceptable, but could be expanded to 2,500 characters for more value.',\n bad:\n 'Insufficient content. Aim for at least 600 words to provide value and rank well in search results.'\n }\n };\n\n this.identifier = 'textLength';\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 * @param i18n\n * @returns {AssessmentResult} The result of the assessment, containing both a score and a descriptive text.\n */\n getResult({paper, researcher, i18n}) {\n const calculatedResult = this.calculateResult(paper, i18n);\n\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 * @param i18n\n * @returns {{score: number, body: React.JSX.Element, status: string}}\n */\n calculateResult(paper, i18n) {\n const wordCount = countWords(paper.getText());\n const charCount = countCharacters(paper.getText());\n\n let status = 'bad';\n if (charCount < 2500 && wordCount >= 600) {\n status = 'improve';\n }\n if (wordCount < 600 && charCount < 2500) {\n status = 'bad';\n }\n if (charCount >= 2500 && wordCount >= 600) {\n status = 'good';\n }\n\n const score = this.getScore(this._config.priority, status);\n\n return {\n score,\n status\n };\n }\n}\n"],"mappings":"AAAA,SAAQA,KAAK,QAAO,QAAQ;AA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