Skip to content
This repository was archived by the owner on Apr 12, 2020. It is now read-only.

Optimized the normalize search function...#11

Open
fan1200 wants to merge 1 commit into
BobNisco:masterfrom
fan1200:master
Open

Optimized the normalize search function...#11
fan1200 wants to merge 1 commit into
BobNisco:masterfrom
fan1200:master

Conversation

@fan1200

@fan1200 fan1200 commented Apr 27, 2016

Copy link
Copy Markdown

to remove featuring artists and many tags used in the titles like official music video, hd, radio edit, etc.

I finally had some spare time to optimize the normalization of the video titles. I did this with some regex expression which will remove unnecessary tags from the title. It does the following:

  • Lowercased the query for a better start
  • Removing featuring artists (at the beginning and at the end of a tittle)
  • Removing tags ("official music video"," hd", "radio edit", etc.)
  • Finding groups of parentheses at the end of title like : (alternative name) (produced by)
    which will remove the last group in this case.

With these fixes I was able to cover most of the tracks of my Youtube playlists (almost everything) this was not possible with the live version. It has been tested with various Youtube playlists and some Reddit lists.

…and many tags used in the titles like official music video, hd, radio edit, etc.
Comment thread src/js/track.js
});

normalized = normalized.replace(/((ft. |& |feat. |and |& |vs | [xX] )(.*?)(?=-))/, ''); // remove featuring artist at the beginning
normalized = normalized.replace(/((ft. |& |feat. |and |& |vs | [xX] )(.*))/,'') // remove featuring artist and everything after at the end

@BobNisco BobNisco May 8, 2016

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm worried that this is too aggressive. For example, The Midnight - Lost & Found (The Midnight Remix) gets cleaned to just be the midnight - lost. Another example: G-Eazy x Bebe Rexha - Me, Myself & I becomes just g-eazy- me, myself

Perhaps try scoping this regex down a bit?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this feature be set up to activate only in situations where no search results are returned?

@fan1200

fan1200 commented Aug 8, 2016

Copy link
Copy Markdown
Author

I now have 3 weeks off, maybe I can find the time to edit the code. Would be nice to see this feature in the live version since the live version doesn't show as much as mine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants