HomeFeed

我爱正则表达式

关注正则表达式和搜索引擎

Posts Tagged @ root

[老贴整理]如何使用正则式从英文句子里提取词根2008-04-25 4:07 pm

admin

以前在chinaunix回答过这样一个问题,用到了正则表达式(而且我认为正则式解决此类问题是最合适的。)

学英语的一些例句,每句都有若干词根相同的词,例如 She swears to wear the pearls that appear to be pears. 但是每句的词根都未必相同;我希望把这些包含词根的词都标记出来,请问如何写?

这里说的词根不是原本词根的定义,只是一组字母序列,比如

9. The dust in the industrial zone frustrated the industrious man.

词根是dust或ust

10. The just budget judge just justifies the adjustment of justice.

词根是dust

11. I used to abuse the unusual usage, but now I’m not used to doing so.

词根是use,有变形

12. The lace placed in the palace is replaced first, and displaced later.

词根是lace

13. I paced in the peaceful spacecraft.

词根是pace

14. Sir, your bird stirred my girlfriend’s birthday party.

词根是ir

如果您对此问题感兴趣,请独立思考后再继续阅读本站提供的解决方法。

Continue »

Comments

Permanent Link | Posted in 问答 | Tags on: , ,

© 我爱正则表达式 Allrights reserved. | Theme: iPost 2.7.2 |Designed By iFire. | Powered by WP. | Entries (RSS) | Comments (RSS).