vi3k6i5 / flashtext

Extract Keywords from sentence or Replace keywords in sentences.
MIT License
5.57k stars 598 forks source link

how to do #52

Open leepand opened 6 years ago

leepand commented 6 years ago

keyword_processor = KeywordProcessor() keyword_processor.add_keyword('Big Apple','Big_Apple') keyword_processor.add_keyword('Apple and','Apple_and') keyword_processor.replace_keywords(u'I love Big Apple and Bay Area.')

result: u'I love Big_Apple and Bay Area.' but i want the result is :u'I love Big_Apple_and Bay Area.'

how to do?

vi3k6i5 commented 6 years ago

You have to use

keyword_processor.add_keyword('Big Apple ','BigApple')

There is a space after 'Big Apple'.

On Sun 27 May, 2018, 07:33 Leepand, notifications@github.com wrote:

keyword_processor = KeywordProcessor() keyword_processor.add_keyword('Big Apple','Big_Apple') keyword_processor.add_keyword('Apple and','Apple_and') keyword_processor.replace_keywords(u'I love Big Apple and Bay Area.')

result: u'I love Big_Apple and Bay Area.' but i want the result is :u'I love Big_Apple_and Bay Area.'

how to do?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/vi3k6i5/flashtext/issues/52, or mute the thread https://github.com/notifications/unsubscribe-auth/AC-NwuKp7D0kNrC1GVmSCju2TbT7c2ehks5t2gldgaJpZM4UPHfu .