In a nutshell: translate from french to english.
You need to first pip install wiktionaryparser
and bs4
.
Then simply use python flate.py [french word]
.
This code relies on Wiktionary to translate from french to English. To make things faster, this is the order it follows to retreive the translation:
- search in the local Wiktionary dump I downloaded from this repository
- search using the wiktionaryparser (will probably get rid of eventually)
- search Wiktionary using a function I created
- search Linguee (scraping)
This code also returns the infinitive's meaning for words in the past participle and other forms. Wikitionary does not currently support this directly.
- Linguee has rules about how it is used
- This code is not finished yet -- currently it does not support lookup for terms like "l'homme", as opposed to "homme"
- Only the first definition retrieved is returned. This is silly, I know, but I have not expanded it as I'm still testing this
- I have not tested it for all cases of French words possible; I have covered the common ones, but definitely not all of them.
- I want to transfer the text files dictionary into a SQLite or PostgreSQL database