UNPKG

yoastseo

Version:

Yoast client-side content analysis

27 lines (25 loc) 1 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _getWords = _interopRequireDefault(require("./getWords")); var _functionWords = _interopRequireDefault(require("../config/functionWords")); function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; } /** * Filters out function words and removes じゃ ending if a words ends in it. * * @param {string} text The input text. * * @returns {Array} The array words with function words filtered out and じゃ removed. */ function _default(text) { let words = (0, _getWords.default)(text); // Filter function words and morphemes. words = words.filter(word => !_functionWords.default.includes(word)); // Check if the segment ends in -じゃ, and remove the ending if it does. const ending = "じゃ"; words = words.map(word => word.endsWith(ending) ? word.slice(0, -ending.length) : word); return words; } //# sourceMappingURL=getContentWords.js.map