Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

190
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!