LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-12-2012, 09:49 AM   #1
b3rkl3y
LQ Newbie
 
Registered: May 2009
Posts: 5

Rep: Reputation: 0
Question bash: find the closest match?


Greetings,

I'm writing an IVR for asterisk with voice recognition (so far so good).

I would like to enable my the caller to "speak the name of the person that he wants to talk, convert voice to text, and pass the result to a bash script wich would get the text, compare with names on the list, get the most similar and return the correct name and extension to asterisk." (atm this is working fine if voice to text gets the correct name)

The problem is that is common for voice to text to misunderstand some letters or even some parts of the name
Can someone give me an idea about a good way in bash for comparing a variable against a list of words/strings (in a text file) and get the "closest match"? (or even the the best matches?)

Any suggestions would be greatly appreciated!

Thank you!
 
Old 10-12-2012, 12:04 PM   #2
casualfred
Member
 
Registered: Aug 2012
Location: USA
Distribution: Slackware 14.1
Posts: 57

Rep: Reputation: 11
Just throwing some ideas out there - maybe you could make a custom dictionary for aspell and get it to autocorrect the names maybe like this (they're using python in the post):
http://stackoverflow.com/questions/1...-spell-checker

Of course I've never even attempted anything like this myself, but maybe it could work?
 
Old 10-13-2012, 09:38 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
You can try using agrep for approximate string matching. The newer tre-based version seems to be a bit better overall, but information on how to use it is quite scant on the web.

http://laurikari.net/tre/about/


Edit: Another library/application that might be useful here is the fstrcmp fuzzy string comparison tool.

http://fstrcmp.sourceforge.net/

Last edited by David the H.; 10-13-2012 at 10:00 AM. Reason: as stated
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] bash autocomplete space after match suicidaleggroll Linux - Newbie 2 08-07-2012 04:59 PM
BASH print only first match from 'find' command. SilversleevesX Programming 3 09-15-2010 07:06 AM
LXer: 'Find Closest' Mashup Plugin with Ruby on Rails LXer Syndicated Linux News 0 01-10-2009 04:10 AM
grep/sed/awk - find match, then match on next line gctaylor1 Programming 3 07-11-2007 08:55 AM
function to find the closest prime number... sachitha Programming 2 10-20-2006 02:47 PM


All times are GMT -5. The time now is 07:54 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration