UNPKG

yoastseo

Version:

Yoast client-side content analysis

39 lines (37 loc) 1.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _lodash = require("lodash"); var _yoastseo = require("yoastseo"); var _passiveVoiceRegex = _interopRequireDefault(require("../../config/internal/passiveVoiceRegex.js")); var _passiveVoiceIrregulars = _interopRequireDefault(require("../../config/internal/passiveVoiceIrregulars.js")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } const { getWords } = _yoastseo.languageProcessing; const regexFunction = (0, _passiveVoiceRegex.default)(); const verbsBeginningWithErVerEntBeZerHerUber = regexFunction.verbsBeginningWithErVerEntBeZerHerUber; const verbsBeginningWithGe = regexFunction.verbsBeginningWithGe; const verbsWithGeInMiddle = regexFunction.verbsWithGeInMiddle; const verbsWithErVerEntBeZerHerUberInMiddle = regexFunction.verbsWithErVerEntBeZerHerUberInMiddle; const verbsEndingWithIert = regexFunction.verbsEndingWithIert; /** * Creates German participles array for the participles found in a clause. * * @param {string} clauseText The clause to finds participles in. * * @returns {Array} The array with the German participles found. */ function _default(clauseText) { const words = getWords(clauseText); const foundParticiples = []; (0, _lodash.forEach)(words, function (word) { if (verbsBeginningWithGe(word).length !== 0 || verbsWithGeInMiddle(word).length !== 0 || verbsBeginningWithErVerEntBeZerHerUber(word).length !== 0 || verbsWithErVerEntBeZerHerUberInMiddle(word).length !== 0 || verbsEndingWithIert(word).length !== 0 || _passiveVoiceIrregulars.default.includes(word)) { foundParticiples.push(word); } }); return foundParticiples; } //# sourceMappingURL=getParticiples.js.map