Using gensim to build a word2Vec model based on over 1300 French texts from the nineteenth century, I am writing code that takes a pair of words (e.g. "homme" and "femme") and a text (Le Père Goriot, by Balzac) as parameters and generates an "modulated" text. Each word in the original text is replaced by a word that is "most similar" to it according to the word pair. For instance, if "roi" is a word in the original text, it would be replaced thusly:
Handling verb conjugations and adjective agreements in French is tricky but I aim to produce a mostly readable text. The code will hopefully be able to "modulate" any text in French against any pair of words.
And it's more or less done! Here's the repository with the input text, code, vector data and output. The generated novel is Madame Bovary Modulée, based on Flaubert's famous text.
Using gensim to build a word2Vec model based on over 1300 French texts from the nineteenth century, I am writing code that takes a pair of words (e.g. "homme" and "femme") and a text (Le Père Goriot, by Balzac) as parameters and generates an "modulated" text. Each word in the original text is replaced by a word that is "most similar" to it according to the word pair. For instance, if "roi" is a word in the original text, it would be replaced thusly:
Handling verb conjugations and adjective agreements in French is tricky but I aim to produce a mostly readable text. The code will hopefully be able to "modulate" any text in French against any pair of words.