I am currently writing my own voice assistant in python using nltk for preprocessing and pytorch for processing the data. After lots of hours searching for any method, I can't find a way to extract the title of a song from other spoken text. So what I want to achieve is at example filtering "Numb" out of "Play numb by Linkin Park". Is this somehow possible with NLP or just using neural network and how?
Asked
Active
Viewed 191 times
1
-
Could you provide a minimal example of what you've already tried? – PirateNinjas Nov 22 '21 at 15:00
-
@PirateNinjas basically I just tried a simple feed forward neural net. My input layer had 20 inputs which corresponds to the text with some padding. As output I have used the indices of the song title (so start index and end index). But after training I juts get values < 0, so that doesn't seem to work. Also my method to convert strings to numbers is kinda weird. Just getting the characters values and putting them together. – PrimoDev23 Nov 22 '21 at 16:02
1 Answers
-1
This is potentially quite a difficult problem to solve generally. As a first pass, you could try imposing some additional assumptions:
- The text passed to your "song name extractor" is perfectly translated from speech
- The user will follow a set format for requesting the song
If you make these assumptions the problem can be solved using regex, like so:
import re
# your input text
song_request = "Play numb by Linkin Park"
# search the input text for a matching substring
song_search = re.search("(?<=Play ).*(?= by)", song_request)
# if you get a match, extract the song title
if song_search:
song_title = song_search.group()
else:
song_title = "" # just in case your assumption doesn't hold

PirateNinjas
- 1,908
- 1
- 16
- 21
-
Well with a fixed pattern that's possible yeah but since the assistant is in German there is more than one possible sentence pattern. Generally I would prefer not to use static patterns. I have no problem with building a neural net but my current tests don't look promising – PrimoDev23 Nov 22 '21 at 14:59