A data company that worked with Vote Leave on the Brexit referendum has secured a deal to help develop artificial intelligence (AI) to handle teachers’ lesson plans and mark homework.