Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Software
User Name
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.


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

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


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
Registered: Aug 2012
Location: USA
Distribution: Slackware64-14.2
Posts: 86

Rep: Reputation: 23
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):

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,826

Rep: Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973Reputation: 1973
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.

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

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


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 > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:08 AM.

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