async run(srcInput) { const input = srcInput; const locale = input.locale || 'en'; const stemmer = this.container.get(`stemmer-${locale}`) || this; input.tokens = await stemmer.stem( input.text || input.tokens.join(' '), input ); return input; }
run(srcInput) { if (srcInput.settings && srcInput.settings.keepStopwords === false) { const input = srcInput; const locale = input.locale || 'en'; const remover = this.container.get(`stopwords-${locale}`) || this; input.tokens = remover .removeStopwords(input.tokens, input) .filter((x) => x); return input; } return srcInput; }
params.tokens.forEach(function forToken(token) { if (token.type === "heading_open") { heading = token; } else if (token.type === "heading_close") { heading = null; } else if ((token.type === "inline") && heading) { handler(heading, token.content); } });
async getTokens(srcInput) { const input = srcInput; if (!input.tokens && input.sentimentDictionary.type) { input.tokens = await this.prepare( input.locale, input.utterance || input.text, input.settings ); } return input; }
params.tokens.every(function forToken(token) { if (token.type === "heading_open") { addErrorDetailIf(onError, token.lineNumber, tag, token.tag); return false; } return true; });
params.tokens .filter(function (token) { return token.type === "fence"; }) .forEach(function (fenceToken) { var lineNumber = fenceToken.lineNumber, markup = fenceToken.markup; if (expectedStyle === "consistent") { expectedStyle = fencedCodeBlockStyleFor(markup); } addErrorDetailIf(onError, lineNumber, expectedStyle, fencedCodeBlockStyleFor(markup)); });
params.tokens.every((token) => { if (token.type === "html_block") { return true; } if ((token.type !== "heading_open") || (token.tag !== tag)) { addErrorContext(onError, token.lineNumber, token.line); } return false; });
params.tokens .filter(function (token) { return token.type === "code_block" || token.type === "fence"; }) .forEach(function (token) { var lineNumber = token.lineNumber, type = token.type; if (expectedStyle === "consistent") { expectedStyle = tokenTypeToStyle[type]; } addErrorDetailIf(onError, lineNumber, expectedStyle, tokenTypeToStyle[type]); });
params.tokens.forEach((token) => { if (token.type === "hr") { onError({ "lineNumber": token.lineNumber, "detail": "Sample error for hr" }); } });
params.tokens.forEach(function forToken(token) { if (token.type === "heading_open") { heading = token; } else if (token.type === "heading_close") { heading = null; } else if ((token.type === "inline") && heading) { handler(heading, token.content); } });
params.tokens.forEach(function forToken(token) { if (token.type === "heading_open") { heading = token; } else if (token.type === "heading_close") { heading = null; } else if ((token.type === "inline") && heading) { handler(heading, token.content); } });
params.tokens.every(function forToken(token) { if (token.type === "heading_open") { addErrorDetailIf(onError, token.lineNumber, tag, token.tag); return false; } return true; });
params.tokens.every(function (token) { if (token.type === "html_block") { return true; } if ((token.type !== "heading_open") || (token.tag !== tag)) { addErrorContext(onError, token.lineNumber, token.line); } return false; });