Skip to content

cityssm/text-to-search-terms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

text-to-search-terms

npm (scoped) DeepSource Maintainability codecov

Reduces large strings of text into distinct search terms.

import {
  textToSearchTermsString,
  OPTIONS_ALL
} from '@cityssm/text-to-search-terms'

console.log(
  textToSearchTerms("Hop to the shop! There's a sale on a mop!", OPTIONS_ALL)
)
// "mop on sale shop there's to"

Options

Option Default
removeCase true
removePunctuation true
removeDiacritics false
removeWordsWithoutLettersOrNumbers false
sortAlphabetically false
removeDuplicateWords true
removeDuplicatePartialWords false