UNPKG

yoastseo

Version:

Yoast client-side content analysis

51 lines (48 loc) 1.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _yoastseo = require("yoastseo"); var _functionWords = require("../config/functionWords.js"); var _getParticiples = _interopRequireDefault(require("../helpers/internal/getParticiples.js")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const { directPrecedenceException, precedenceException, values } = _yoastseo.languageProcessing; const { Clause } = values; /** * Creates a Clause object for the Italian language. */ class ItalianClause extends Clause { /** * Constructor. * * @param {string} clauseText The text of the clause. * @param {Array} auxiliaries The auxiliaries. * * @constructor */ constructor(clauseText, auxiliaries) { super(clauseText, auxiliaries); this._participles = (0, _getParticiples.default)(this.getClauseText()); this.checkParticiples(); } /** * Checks if any exceptions are applicable to this participle that would result in the sentence part not being passive. * If no exceptions are found, the sentence part is passive. * * @returns {boolean} Returns true if no exception is found. */ checkParticiples() { const clause = this.getClauseText(); const passiveParticiples = this.getParticiples().filter(participle => !directPrecedenceException(clause, participle, _functionWords.cannotDirectlyPrecedePassiveParticiple) && !precedenceException(clause, participle, _functionWords.cannotBeBetweenPassiveAuxiliaryAndParticiple)); this.setPassive(passiveParticiples.length > 0); } } var _default = exports.default = ItalianClause; //# sourceMappingURL=Clause.js.map