Modelling cultural shift : Application to language decline and extinction