A simple command-line tool for searching Wiktionary.
Project description
Search Wiktionary
A simple command-line tool for searching English Wiktionary using Wiktionary Parser (click).
Wiktionary definitions are licensed under CC BY-SA 4.0. Visit wiktionary at wiktionary.org (click).
I wrote a quick and dirty version of this program last year because I wanted a way to search Wiktionary quickly while I worked. Not only does it save clicks, it also skips right to the language you care about, which is useful for words that are in a lot of languages, like "ac." I decided to brush it up into something I could share as a personal exercise to sharpen my Python skills and learn about git and other dev tools. Some other tools that do the same thing exist. Using Wiktionary Parser:
And an entire program that can search both Wiktionary and Wikipedia:
- wikimedia-cli (click)
Installation
No pip module yet, so you'll have to clone the repository for now.
git clone https://github.com/lauramvx/search_wikt
Then cd
to the project directory and run:
pip install -r requirements.txt
to install the project's dependencies. To run the program, type:
py src\search_wikt\core.py apricot -language English
or any other word or language you'd like to search. Run py src\search_wikt\core.py -h
or --help
for a more detailed explanation.
Examples
py src\search_wikt\core.py hunig -l "Old English"
hunig
From Proto-West Germanic *hunag, from Proto-Germanic *hunagą. Cognate with Old Frisian hunig, Old Saxon honeg, and Old High German honag; also Old Norse hunang, from the alternative form *hunangą.
IPA: /ˈxu.nij/, [ˈhu.nij]
noun
huniġ n
honey
py src\search_wikt\core.py ac -l "Old English" -ex -r
ac 1
From Proto-Germanic *aiks.
IPA: /ɑːk/
IPA: /ɑk/
noun
āc f
oak (wood or tree)
(poetic) an oaken ship
(masculine) the runic character ᚪ (/a/)
ac 2
From Proto-Germanic *ak.
IPA: /ɑːk/
IPA: /ɑk/
conjunction
ac
but
but instead: in this sense ac should sometimes be translated as "but," but most often it is best left untranslated
Sēo æx forġiett, ac þæt trēow ġeman.The axe forgets, but the tree remembers.
The axe forgets, but the tree remembers.
Ne ġēotaþ wē tēaras, ac blōd.We don't shed tears, we shed blood.
We don't shed tears, we shed blood.
Nōn egō, sed tū: “Nā iċ, ac þū.” Nōn bōs est, sed equus: “Nis hit nā oxa, ac is hors.”Non ego, sed tu: “Not me, you.” Non bos est, sed equus: “It's not an ox, it's a horse.”
Non ego, sed tu: “Not me, you.” Non bos est, sed equus: “It's not an ox, it's a horse.”
Issues
When piping to Out-File in PowerShell on Windows I was getting an encode error; to fix it I set the encoding to utf-8. Now it doesn't make any errors, but it displays the wrong Unicode characters! I believe it's because it's trying to draw combination characters.
Upstream, unless I'm missing something, WiktionaryParser doesn't seem to grab citations attached to examples, nor does it reproduce all types of related words; this is an issue when searching Old English words.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file search_wikt-0.0.1.tar.gz
.
File metadata
- Download URL: search_wikt-0.0.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d521063bd4621fb3148a4fa8e3dd7d906465b2e36eb708e2d5d07a4127b85cb |
|
MD5 | 1bb7e4215b2a94bcf38e9d65d4d8ce0c |
|
BLAKE2b-256 | ac9e0edb9978cece6ef2119f19beceb6beb866c678729953b5fc1b1419e9577d |
File details
Details for the file search_wikt-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: search_wikt-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 11f4bd1aae1c3a18657f3d167652b000be32c270681cc5668aa4d3eddbd5bf30 |
|
MD5 | 76e1e93a546920b3288c74b4396b4f53 |
|
BLAKE2b-256 | b683cdc40c096cc0757cbe827ec557209d09a24b774916ad5b5df5138b375628 |