Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

191
Visualizações
Create unique name from array of names in NodeJS

I'm trying to create a unique name which includes all the data that could be found in an array of strings (names). It shouldn't repeat words.

Given this:

[
  'Xiaomi Mi',
  'Xiaomi',
  'Mi',
  'TV',
  'Stick',
  'Xiaomi Mi TV Stick',
  'Xiaomi Mi TV',
  'Mi TV Stick',
  'Mi TV',
  'TV Stick',
  'Reproductor',
  'Reproductor Multimedia',
  'Multimedia'
]

I would like to get something like this:

'Xiaomi Mi TV Stick, Reproductor Multimedia'

I would like to analyze the data (natural language processing, maybe) and come up with a unique name, so the solution shouldn't be about taking the longest elements in the array, for example.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The simplest possible option would be

title = [...new Set(words.join(' ').split(' '))].join(' ')

which creates a long string from all array elements, splits that string into words, and concatenates unique words back.

If you want some "real" NLP, which would, for example, intelligently create "Xiaomi Mi Stick" from [Mi Stick Xiaomi], look around for a library. This is a complex problem that requires thousands lines of code.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda