Python论坛  - 讨论区

标题:[python-chinese] 字符串相似度比较

2007年11月11日 星期日 19:24

Xian Chen hoganxian在gmail.com
星期日 十一月 11 19:24:40 HKT 2007

Ôõô±È½ÏһЩ×Ö·û´®µÄÏàËƶÈÄØ£¿

±ÈÈç:

a = "example/a/001.htm"
b = "example/a/002.htm"
c = "anythingelse.htm"

aºÍbµÄÏàËƶȾͺܸߣ¬ºÍcÏàËƶȾͺܵͣ¬ÔõôÄÜÇø·Ö³öÀ´ÄØ£¿

¶àл
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071111/9d5086ea/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月11日 星期日 19:41

大郎 iexper在gmail.com
星期日 十一月 11 19:41:18 HKT 2007

ps:
a = 'abc.html'
b = 'cba.html'


On Nov 11, 2007 7:24 PM, Xian Chen <hoganxian在gmail.com> wrote:

> Ôõô±È½ÏһЩ×Ö·û´®µÄÏàËƶÈÄØ£¿
>
> ±ÈÈç:
>
> a = "example/a/001.htm"
> b = "example/a/002.htm"
> c = "anythingelse.htm"
>
> aºÍbµÄÏàËƶȾͺܸߣ¬ºÍcÏàËƶȾͺܵͣ¬ÔõôÄÜÇø·Ö³öÀ´ÄØ£¿
>
> ¶àл
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
×îºÃµÄÍƹã±ãÊÇʵ¼ÊÓ¦ÓÃ
×î½üÔÚѧϰweb.py, ¼á³Ö²ÅÄܽø²½
http://twitter.com/qichangxing
Gtalk: iexper(at)gmail.com
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071111/7c7220a0/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月11日 星期日 21:49

Jiahua Huang jhuangjiahua在gmail.com
星期日 十一月 11 21:49:14 HKT 2007

>>> a = "example/a/001.htm"
>>> b = "example/a/002.htm"
>>> c = "anythingelse.htm"
>>> import difflib
>>> len(filter(lambda i: i.startswith('+'), difflib.ndiff(a,b)))
1
>>> len(filter(lambda i: i.startswith('+'), difflib.ndiff(a,c)))
9
>>>


在 07-11-11,Xian Chen<hoganxian at gmail.com> 写道:
> 怎么比较一些字符串的相似度呢?
>

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月11日 星期日 21:52

Jiahua Huang jhuangjiahua在gmail.com
星期日 十一月 11 21:52:03 HKT 2007

或
>>> len(filter(lambda i: i.startswith('+') or i.startswith('-'),
difflib.ndiff(a,b)))
2
>>> len(filter(lambda i: i.startswith('+') or i.startswith('-'),
difflib.ndiff(a,c)))
19


在 07-11-11,Jiahua Huang<jhuangjiahua at gmail.com> 写道:
用 difflib

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月12日 星期一 09:37

Xian Chen hoganxian在gmail.com
星期一 十一月 12 09:37:41 HKT 2007

ºÃµÄ£¬¶àл

ÔÙÑо¿Ò»ÏÂdifflib

On Nov 11, 2007 9:52 PM, Jiahua Huang <jhuangjiahua在gmail.com> wrote:

> »ò
> >>> len(filter(lambda i: i.startswith('+') or i.startswith('-'),
> difflib.ndiff(a,b)))
> 2
> >>> len(filter(lambda i: i.startswith('+') or i.startswith('-'),
> difflib.ndiff(a,c)))
> 19
>
>
> ÔÚ 07-11-11£¬Jiahua Huang<jhuangjiahua在gmail.com> дµÀ£º
> ÓÃ difflib
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071112/02ff4bfb/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月13日 星期二 17:14

张沈鹏(电子科大08年本科应届) zsp007在gmail.com
星期二 十一月 13 17:14:29 HKT 2007

动态规划算法,计算单词距离
http://zsp.javaeye.com/blog/137852

在 07-11-12,Xian Chen<hoganxian at gmail.com> 写道:
> 好的,多谢
>
> 再研究一下difflib
>
>
> On Nov 11, 2007 9:52 PM, Jiahua Huang <jhuangjiahua at gmail.com> wrote:
> > 或
> > >>> len(filter(lambda i: i.startswith('+') or i.startswith('-'),
> >
> > difflib.ndiff(a,b)))
> > 2
> > >>> len(filter(lambda i: i.startswith('+') or i.startswith ('-'),
> > difflib.ndiff(a,c)))
> > 19
> >
> >
> > 在 07-11-11,Jiahua Huang<jhuangjiahua at gmail.com> 写道:
> > 用 difflib
> >
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>


-- 
个人网站:http://zsp007.com.cn/
双学位:生物医学工程+计算机科学与技术
技能:C++(STL,BOOST) Python(Django) HTML+CSS AJAX
-- 张沈鹏

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月14日 星期三 01:41

Fluke fluke.l在gmail.com
星期三 十一月 14 01:41:19 HKT 2007

¶Ôѽ£¬ÊÇstring distance

On 11/13/07, ÕÅÉòÅô(µç×Ó¿Æ´ó08Äê±¾¿ÆÓ¦½ì) <zsp007在gmail.com> wrote:
>
> ¶¯Ì¬¹æ»®Ëã·¨,¼ÆËãµ¥´Ê¾àÀë
> http://zsp.javaeye.com/blog/137852
>
> ÔÚ 07-11-12£¬Xian Chen<hoganxian在gmail.com> дµÀ£º
> > ºÃµÄ£¬¶àл
> >
> > ÔÙÑо¿Ò»ÏÂdifflib
> >
> >
> > On Nov 11, 2007 9:52 PM, Jiahua Huang <jhuangjiahua在gmail.com> wrote:
> > > »ò
> > > >>> len(filter(lambda i: i.startswith('+') or i.startswith('-'),
> > >
> > > difflib.ndiff(a,b)))
> > > 2
> > > >>> len(filter(lambda i: i.startswith('+') or i.startswith ('-'),
> > > difflib.ndiff(a,c)))
> > > 19
> > >
> > >
> > > ÔÚ 07-11-11£¬Jiahua Huang<jhuangjiahua在gmail.com> дµÀ£º
> > > ÓÃ difflib
> > >
> > >
> > >
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese在lists.python.cn
> > > Subscribe: send subscribe to
> > python-chinese-request在lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > python-chinese-request在lists.python.cn
> > > Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to
> > python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request在lists.python.cn
> > Detail Info:
> > http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> --
> ¸öÈËÍøÕ¾:http://zsp007.com.cn/
> ˫ѧλ:ÉúÎïҽѧ¹¤³Ì+¼ÆËã»ú¿ÆѧÓë¼¼Êõ
> ¼¼ÄÜ:C++(STL,BOOST) Python(Django) HTML+CSS AJAX
> -- ÕÅÉòÅô
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese




-- 
Yours,
  fluke
fluke在sfcube.net
http://blog.ospattern.net
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071114/038435f3/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月21日 星期三 10:44

jessinio liang jessinio在gmail.com
星期三 十一月 21 10:44:58 HKT 2007

Å£B,ÏñÊÇÈ˹¤ÖÇÄÜÒ»Ñù
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071121/afa1c4af/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月21日 星期三 16:49

杨益 yangyi.cn.gz在gmail.com
星期三 十一月 21 16:49:34 HKT 2007

ÎÒ¾õµÃÊ×ÏÈÊǶ¨Òå±ê×¼£¬È»ºóÄãÔÙÓóÌÐòÈ¥Ö´ÐÐÕâ¸ö±ê×¼
a = "example/a/001.htm"

 b = "example/a/002.htm"
c = "example/b/001.htm"

Äã˵bºÍc¶ÔaµÄÏàËƶÈÄĸö¸ß£¿

Èç¹û±ê×¼ÊÇ´Ó×óµ½ÓÒ£¬Æ¥ÅäµÄ×Ö·ûÊýÔ½¶à£¬ÏàËƶÈÔ½¸ß£¬ÄÇôbµÄÏàËƶȸßÓÚc
Èç¹û±ê×¼ÊÇËùÓÐ×Ö·û´®ÀÏàͬ´úÂëµÄÊýÁ¿Ô½¶à£¬ÏàËƶÈÔ½¸ß£¬ÄÇôcµÄÏàËƶȸßÓÚa

ÎÊÌâ¾ÍÊÇÄãҪʵÏÖµ½Ê²Ã´³Ì¶È£¬Èç¹ûÄãÇå³þµÄ¶¨ÒåÁËÕâ¸ö±ê×¼£¬ÄǾÍÖªµÀÔõôдÁË


ÔÚ07-11-11£¬Xian Chen <hoganxian在gmail.com> дµÀ£º
>
> Ôõô±È½ÏһЩ×Ö·û´®µÄÏàËƶÈÄØ£¿
>
> ±ÈÈç:
>
> a = "example/a/001.htm"
> b = "example/a/002.htm"
> c = "anythingelse.htm"
>
> aºÍbµÄÏàËƶȾͺܸߣ¬ºÍcÏàËƶȾͺܵͣ¬ÔõôÄÜÇø·Ö³öÀ´ÄØ£¿
>
> ¶àл
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071121/fdc55f4f/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年11月21日 星期三 16:55

Xian Chen hoganxian在gmail.com
星期三 十一月 21 16:55:56 HKT 2007

ÎÒµÄÒâ˼ÊÇ´Ó×óµ½ÓÒÆ¥Åä×Ö·û£¬ÕâÑùÆ¥ÅäµÄÔ½¶àÔ½ºÃ¡£


On Nov 21, 2007 4:49 PM, ÑîÒæ <yangyi.cn.gz在gmail.com> wrote:

> ÎÒ¾õµÃÊ×ÏÈÊǶ¨Òå±ê×¼£¬È»ºóÄãÔÙÓóÌÐòÈ¥Ö´ÐÐÕâ¸ö±ê×¼
> a = "example/a/001.htm"
>
>  b = "example/a/002.htm"
> c = "example/b/001.htm"
>
> Äã˵bºÍc¶ÔaµÄÏàËƶÈÄĸö¸ß£¿
>
> Èç¹û±ê×¼ÊÇ´Ó×óµ½ÓÒ£¬Æ¥ÅäµÄ×Ö·ûÊýÔ½¶à£¬ÏàËƶÈÔ½¸ß£¬ÄÇôbµÄÏàËƶȸßÓÚc
> Èç¹û±ê×¼ÊÇËùÓÐ×Ö·û´®ÀÏàͬ´úÂëµÄÊýÁ¿Ô½¶à£¬ÏàËƶÈÔ½¸ß£¬ÄÇôcµÄÏàËƶȸßÓÚa
>
> ÎÊÌâ¾ÍÊÇÄãҪʵÏÖµ½Ê²Ã´³Ì¶È£¬Èç¹ûÄãÇå³þµÄ¶¨ÒåÁËÕâ¸ö±ê×¼£¬ÄǾÍÖªµÀÔõôдÁË
>
>
> ÔÚ07-11-11£¬Xian Chen <hoganxian在gmail.com> дµÀ£º
> >
> > Ôõô±È½ÏһЩ×Ö·û´®µÄÏàËƶÈÄØ£¿
> >
> > ±ÈÈç:
> >
> > a = "example/a/001.htm"
> > b = "example/a/002.htm"
> > c = "anythingelse.htm"
> >
> > aºÍbµÄÏàËƶȾͺܸߣ¬ºÍcÏàËƶȾͺܵͣ¬ÔõôÄÜÇø·Ö³öÀ´ÄØ£¿
> >
> > ¶àл
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071121/0c531067/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号