An artificial intelligence launched by Microsoft on Twitter has backfired, offering some very offensive tweets.