Is there a package which tests string similarity?

876 views
Skip to first unread message

Athiwat Chunlakhan

unread,
Jul 6, 2011, 12:28:51 PM7/6/11
to golan...@googlegroups.com
I need one for my grader project(for school) if it doesn't exists then I will write one.

-- 
Athiwat Chunlakhan

Jessta

unread,
Jul 6, 2011, 12:54:57 PM7/6/11
to Athiwat Chunlakhan, golan...@googlegroups.com
On Thu, Jul 7, 2011 at 2:28 AM, Athiwat Chunlakhan
<athi...@googlemail.com> wrote:
> I need one for my grader project(for school) if it doesn't exists then I
> will write one.
> --

What do you mean by 'similarity'? What makes one string similar to another?
If you want equality then you can just use '=='

eg.
if stringA == stringB {
//do something
}


--
=====================
http://jessta.id.au

Athiwat Chunlakhan

unread,
Jul 6, 2011, 1:04:22 PM7/6/11
to Jessta, golan...@googlegroups.com
I want more than testing for the equality. I also want the similarity of the string. So the output will be a number like the percentage of similarity. Sorry for my bad English.

-- 
Athiwat Chunlakhan

Miguel Pignatelli

unread,
Jul 6, 2011, 1:10:09 PM7/6/11
to golan...@googlegroups.com

On 06/07/11 17:54, Jessta wrote:
> On Thu, Jul 7, 2011 at 2:28 AM, Athiwat Chunlakhan
> <athi...@googlemail.com> wrote:
>> I need one for my grader project(for school) if it doesn't exists then I
>> will write one.
>> --
>
> What do you mean by 'similarity'? What makes one string similar to another?
> If you want equality then you can just use '=='

I think he is looking for computing the "distance" between strings (for
example, the Levenshtein distance):

http://en.wikipedia.org/wiki/Levenshtein_distance
http://en.wikibooks.org/wiki/Algorithm_Implementation/Strings/Levenshtein_distance

I don't know of any package doing this. But shouldn't be too complicated
to write a function computing this distance.

M;

André Moraes

unread,
Jul 6, 2011, 3:56:37 PM7/6/11
to golan...@googlegroups.com
Also, don't forget to learn the difference from:

for idx := range(str) {
}

for i=int(0); i < len(str); i++; {
}


--
André Moraes
http://andredevchannel.blogspot.com/

James Keane

unread,
Jul 6, 2011, 7:44:39 PM7/6/11
to golan...@googlegroups.com
Here is my crappy 5 minute contribution.

James


2011/7/6 André Moraes <and...@gmail.com>

Vida

unread,
Jul 7, 2011, 8:06:45 AM7/7/11
to golang-nuts
I also created one, 5 minutes contribution.

https://gist.github.com/1069374

On Jul 7, 6:44 am, James Keane <james.ke...@gmail.com> wrote:
> Here is my crappy 5 minute contribution.https://gist.github.com/1068610
>
> James
>
> 2011/7/6 André Moraes <andr...@gmail.com>
Reply all
Reply to author
Forward
0 new messages