const STOP_WORDS = [ 'about', 'after', 'all', 'allows', 'already', 'also', 'alternative', 'always', 'and', 'any', 'are', 'based', 'been', 'before', 'both', 'call', 'can', 'containing', 'default', 'does', 'each', 'either', 'ensure', 'etc', 'every', 'for', 'from', 'get', 'gets', 'given', 'has', 'have', 'how', 'image', 'involve', 'its', 'least', 'lots', 'may', 'more', 'most', 'much', 'must', 'non', 'not', 'occur', 'occurs', 'options', 'over', 'perform', 'performs', 'provide', 'provided', 'ready', 'same', 'see', 'set', 'sets', 'should', 'since', 'spelling', 'such', 'support', 'supported', 'sure', 'take', 'that', 'the', 'their', 'there', 'therefore', 'these', 'this', 'under', 'unless', 'until', 'use', 'used', 'using', 'value', 'values', 'when', 'which', 'while', 'will', 'with', 'without', 'you', ] export const extractDescription = (str: string): string => str .replace(/\(http[^)]+/g, '') .replace(/\s+/g, ' ') .replace(/[^A-Za-z0-9_/\-,. ]/g, '') .replace(/\s+/g, ' ') .substr(0, 180) .trim() export const extractKeywords = (str: string, words = STOP_WORDS): string => [ ...new Set( str .split(/[ -/]/) .map(word => word.toLowerCase().replace(/[^a-z]/g, '')) .filter(word => word.length > 2 && word.length < 15 && !words.includes(word)), ), ].join(' ')