Search code examples
pythonnlp

Python: from 'vintagecar' to 'vintage car' using google features ('did you mean' feature)


I have a huge number of Flicker tags such as 'brightonflyingseptember2012', which means 'Brighton flying September 2012', I am trying to extract the terms from the tags. I used a spell checker, but it didn't give me any results. I want to use google in my python script, but I didn't find any explanation on how to use Google features such as (did you mean) or (showing results for... instead of). I only found old codes from 2010 and 2011 but didn't work.

I tried to use google package as follow:

import google 
google.search('brightonflyingseptember2012')

I got the following error: module 'google' has no attribute 'search'

I appreciate any suggestion


Solution

  • you can use wordninja library for this..

    import wordninja
    ' '.join(wordninja.split("brightonflyingseptember2012"))
    
    #op
    'brighton flying september 2012'