Skip to main content

parser class for vaiouse online-dict, e.g. collinsdictionary/lexico/vocabulary/spanishdict etc.

Project description

Parser for Web dictionaries

Installation

pip install web-dict

Web Sites

Vocabulary.com

  • class VocabularyDictionary supports English only
  • use .do_search method as which supports mono-language
from web_dict import VocabularyDictionary
dict_ = VocabularyDictionary()
defs = dict_.do_search(word='python')

returns:

{
    "audio": "https://audio.vocab.com/1.0/us/P/6XU2813JWEQB.mp3",
    "long_def": "A python will grab smaller animals with its sharp teeth and then use its powerful coils to constrict the prey until it stops breathing. Pythons can also eat animals larger than they are — occasionally, pythons have been known to eat antelope and deer. The word python comes from Greek mythology, in which Python was a dragon or serpent who guarded the Delphic oracle until he was eventually killed by Apollo.",
    "head_word": "python",
    "short_def": "A python is a very large, nonvenomous snake. Instead of injecting poison through their fangs, pythons kill by wrapping around and asphyxiating their prey. You certainly wouldn't want to be a python's main squeeze.",
    "defs": {
        "primary": [
            {
                "exp": "large Old World boas",
                "pos": [
                    "n"
                ]
            },
            {
                "exp": "a soothsaying spirit or a person who is possessed by such a spirit",
                "pos": [
                    "n"
                ]
            }
        ],
        "full": [
            {
                "examples": [],
                "exp": "large Old World boas",
                "pos": "n"
            },
            {
                "examples": [],
                "exp": "a soothsaying spirit or a person who is possessed by such a spirit",
                "pos": "n"
            }
        ]
    }
}

Collinsdictionary.com

  • class CollinsDictionary supports below languages, respectively call method .en2es or .es2en etc.
{
    "es": "spanish",
    "zh": "chinese",
    "de": "german",
    "fr": "french",
    "en": "english"
}
from web_dict import CollinsDictionary
dict_ = CollinsDictionary()
defs = dict_.es2en(word='hacer')

returns

{
    "audio": "https://www.collinsdictionary.com/sounds/hwd_sounds/ES-419-W0025780.mp3",
    "defs": [
        {
            "senses": [
                {
                    "senses": [],
                    "examples": [
                        {
                            "sent": "¿qué haces?",
                            "trans": "what are you doing?"
                        },
                        {
                            "sent": "¿qué haces ahí?",
                            "trans": "what are you doing there?"
                        },
                        {
                            "sent": "no sé qué hacer",
                            "trans": "I don’t know what to do"
                        },
                        {
                            "sent": "hace y deshace las cosas a su antojo",
                            "trans": "she does as she pleases"
                        },
                        {
                            "sent": "¡eso no se hace!",
                            "trans": "that’s not done!"
                        },
                        {
                            "sent": "no hizo nada por ayudarnos",
                            "trans": "she didn’t do anything to help us"
                        },
                        {
                            "sent": "haz todo lo posible por llegar a tiempo",
                            "trans": "do everything possible to arrive on time"
                        },
                        {
                            "sent": "no tiene sentido hacer las cosas por hacerlas",
                            "trans": "there’s no point doing things just for the sake of it"
                        }
                    ],
                    "exp": "to do",
                    "syn": {
                        "syn": "",
                        "geo": null
                    },
                    "idioms": [
                        {
                            "orth": "¡qué le vamos a hacer!",
                            "trans": "what can you do?"
                        },
                        {
                            "orth": "hacer algo por hacer",
                            "trans": "there’s no point doing things just for the sake of it"
                        },
                        {
                            "orth": "¡la hemos hecho buena!",
                            "trans": "we’ve really gone and done it now! (informal)"
                        },
                        {
                            "orth": "ya ha hecho otra de las suyas",
                            "trans": "he’s been up to his old tricks again"
                        }
                    ]
                },
                {
                    "senses": [],
                    "examples": [
                        {
                            "sent": "él protestó y yo hice lo mismo",
                            "trans": "he protested and I did the same"
                        },
                        {
                            "sent": "no viene tanto como lo solía hacer",
                            "trans": "he doesn’t come as much as he used to"
                        }
                    ],
                    "exp": "to do",
                    "syn": {
                        "syn": "",
                        "geo": null
                    },
                    "idioms": []
                }]
        }
    ],
    "rank": 5,
    "head_word": "hacer"
}

SpanishDict.com

  • class SpanishDictDictionary supports English only
  • use .do_search method as which supports mono-language

Lexico.com

  • en-es
  • es-en
  • en
  • es

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

web_dict-0.1.5.tar.gz (17.1 kB view details)

Uploaded Source

File details

Details for the file web_dict-0.1.5.tar.gz.

File metadata

  • Download URL: web_dict-0.1.5.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.40.0 CPython/3.8.0

File hashes

Hashes for web_dict-0.1.5.tar.gz
Algorithm Hash digest
SHA256 008e0d1ff27bce647c17e73999802619d7ca35399e765b202aa0f129d4fdb30a
MD5 f2a659bc27a7f9c9bbe7df41aa693b1c
BLAKE2b-256 bab3906b3849ef098b41eb87ef1fe11e2f2d72d723613fe4b5cec0eb0c0689fc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page