Skip to main content

A comprehensive lexical discovery application that is useful for finding semantic relationships such as, the antonyms, synonyms, hypernyms, hyponyms, homophones and definitions for a specific word.

Project description

Overview

The Oxford Dictionary defines wordhoard as a supply of words or a lexicon. Wordhoard is a Python 3 module that can be used to obtain antonyms, synonyms, hypernyms, hyponyms, homophones and definitions for words.

Primary Use Case

Textual analysis is a broad term for various research methodologies used to qualitatively describe, interpret and understand text data. These methodologies are mainly used in academic research to analyze content related to media and communication studies, popular culture, sociology, and philosophy. Textual analysis allows these researchers to quickly obtain relevant insights from unstructured data. All types of information can be gleaned from textual data, especially from social media posts or news articles. Some of this information includes the overall concept of the subtext, symbolism within the text, assumptions being made and potential relative value to a subject (e.g. data science). In some cases it is possible to deduce the relative historical and cultural context of a body of text using analysis techniques coupled with knowledge from different disciplines, like linguistics and semiotics.

Word frequency is the technique used in textual analysis to measure the frequency of a specific word or word grouping within unstructured data. Measuring the number of word occurrences in a corpus allows a researcher to garner interesting insights about the text. A subset of word frequency is the correlation between a given word and that word's relationship to either antonyms and synonyms within the specific corpus being analyzed. Knowing these relationships is critical to improving word frequencies and topic modeling.

Wordhoard was designed to assist researchers performing textual analysis to build more comprehensive lists of antonyms, synonyms, hypernyms, hyponyms and homophones.

Installation

Install the distribution via pip:

pip3 install wordhoard

Antonyms Module Usage

An antonym is word that has the exact opposite meaning of another word or its antonym.

Antonym examples:

  • bad and good
  • fast and slow
  • stop and go

from wordhoard import Antonyms

antonym = Antonyms('mother')
antonym_results = antonym.find_antonyms()
print(antonym_results)
['abort', 'begetter', 'brush', 'brush aside', 'brush off', 'child', 'dad', 'daughter', 'descendant', 
 'effect', 'end','father', 'follower', 'forget', 'ignore', 'lose', 'male parent', 'miscarry', 
 'neglect', 'offspring', 'overlook', 'result', 'slight']

Antonyms written to Python dictionary

from wordhoard import Antonyms

antonyms_results = {}
list_of_words = ['mother', 'daughter', 'father', 'son']

for word in list_of_words:
    antonym = Antonyms(word)
    results = antonym.find_antonyms()
    antonyms_results[word] = results

for key, value in antonyms_results.items():
    print(key, value)
    
    mother ['abort', 'begetter', 'brush', 'brush aside', 'brush off', 'child', 'dad', 'daughter', 
            'descendant', 'effect', 'end', 'father', 'follower', 'forget', 'ignore', 'lose', 
            'male parent', 'miscarry', 'neglect', 'offspring', 'overlook', 'result', 'slight']
    
    daughter ['ben', 'boy', 'child', 'dad', 'dependents', 'father', 'fils', 'male', 'male offspring', 
              'mom', 'mother', 'parent', 'parents', 'son']

    father ['child', 'children', 'classical', 'daughter', 'descendant', 'destroy', 'effect', 'end', 
            'family', 'female parent', 'finish', 'halt', 'heir', 'inheritor', 'issue', 'kill', 'lineage', 
            'mom', 'mother', 'offspring', 'posterity', 'progeny', 'result', 'ruin', 'scion', 'seed', 
            'son', 'stay', 'stock', 'stop', 'successor', 'supporter']

    son ['child', 'dad', 'daughter', 'father', 'female', 'female offspring', 'girl', 'parent']

Synonyms Module Usage

A synonym is a word or phrase that means exactly or nearly the same as another word or phrase in the same language.

Synonym examples:

  • happy, joyful, elated, cheerful
  • bad, evil, rotten, corrupt
  • cold, chilly, freezing, frosty

from wordhoard import Synonyms

synonym = Synonyms('mother')
synonym_results = synonym.find_synonyms()
print(synonym_results)
['ancestor', 'antecedent', 'architect', 'author', 'begetter', 'beginning', 'child-bearer', 'creator', 'dam',
 'female parent', 'forebearer', 'forefather', 'foster mother', 'founder', 'fount', 'fountain', 'fountainhead',
 'genesis', 'inspiration', 'inventor', 'lady', 'ma', 'maker', 'mam', 'mama', 'mamma', 'mammy', 'mater', 'materfamilias',
 'matriarch', 'mom', 'momma', 'mommy', 'mother-in-law', 'mum', 'mummy', 'nurse', 'old lady', 'old woman', 'origin',
 'originator', 'para I', 'parent', 'predecessor', 'primipara', 'procreator', 'producer', 'progenitor', 'provenience',
 'puerpera', 'quadripara', 'quintipara', 'sire', 'source', 'spring', 'start', 'stimulus', 'supermom',
 'surrogate mother', 'wellspring']

Synonyms written to Python dictionary

from wordhoard import Synonyms

synonyms_results = {}
list_of_words = ['mother', 'daughter', 'father', 'son']

for word in list_of_words:
    synonym = Synonyms(word)
    results = synonym.find_synonyms()
    synonyms_results[word] = results

for key, value in synonyms_results.items():
    print(key, value)
    
    mother['female parent', 'ma', 'mama', 'mamma', 'mammy', 'mater', 'mom', 'momma', 'mommy', 
           'mother-in-law', 'mum', 'mummy', 'para I', 'parent', 'primipara', 'puerpera', 
           'quadripara', 'quintipara', 'supermom', 'surrogate mother']
    
    daughter['female offspring', 'girl', "mother's daughter"]
    
    father['begetter', 'dad', 'dada', 'daddy', 'father-in-law', 'male parent', 'old man', 'pa', 'papa', 
           'pappa', 'parent', 'pater', 'pop']
    
    son['Jnr', 'Jr', 'Junior', 'boy', 'male offspring', "mama's boy", "mamma's boy", 'man-child', "mother's boy"]

Hypernyms Module Usage

Hypernym: (semantics) A word or phrase whose referents form a set including as a subset the referents of a subordinate term. Musical instrument is a hypernym of "guitar" because a guitar is a musical instrument.

A hypernym is a word with a broad meaning that more specific words fall under. Other names for hypernym include umbrella term and blanket term.

Hypernym examples:

  • diamond is a hypernym of gem
  • eagle is a hypernym of bird
  • red is a hypernym of color

from wordhoard import Hypernyms

hypernym = Hypernyms('red')
hypernym_results = hypernym.find_hypernyms()
print(hypernym_results)
['amount', 'amount of money', 'card games', 'chromatic color', 'chromatic colour', 'color', 
 'colour', 'cooking', 'geographical name', 'hair', 'hair color', 'lake', 'person', 'radical', 
 'rainbow', 'river', 'spectral color', 'spectral colour', 'sum', 'sum of money']

Hyponyms Module Usage

A hyponym is a word of more specific meaning than a general or superordinate term applicable to it.

Hyponym examples:

  • horse is a hyponym of animal
  • table is a hyponym of furniture
  • maple is a hyponym of tree

from wordhoard import Hyponyms

hyponym = Hyponyms('horse')
hyponym_results = hyponym.find_hyponyms()
print(hyponym_results)
['american saddlebred', 'andalusian horse', 'arabian horse', 'azteca horse', 'barb horse', 'belgian horse',
 'belgian warmblood', 'clydesdale horse', 'coldblood trotter', 'curly horse', 'dutch warmblood', 'ethiopian horses',
 'falabella', 'fjord horse', 'friesian horse', 'gypsy horse', 'lusitano', "przewalski's horse", 'shire horse',
 'wild horse']

Homophones Module Usage

A homophone is a word that is pronounced the same as another word but differs in meaning.

Homophone examples:

  • one is a homophone of won
  • ate is a homophone of eight
  • meet is a homophone of meat

from wordhoard import Homophones

homophone = Homophones('horse')
homophone_results = homophone.find_homophones()
print(homophone_results)
['horse is a homophone of hoarse']

Definitions Module Usage

A definition is a statement of the exact meaning of a word, especially in a dictionary.

from wordhoard import Definitions

definition = Definitions('mother')
definition_results = definition.find_definitions()
print(definition_results)
["a person's own mother", 'a woman who has given birth to a child (also used as a term of address to your mother)',
 'female person who has borne children']

Additional Features

wordhoard uses an in-memory cache, which helps prevent redundant queries to an individual resource for the same word. This application also uses Python logging to both the terminal and to the logfile wordhoard_error.yaml.

Dependencies

This package has these dependencies:

  1. BeautifulSoup
  2. deep-translator
  3. lxml
  4. requests
  5. urllib3

License

The MIT License (MIT). Please see License File for more information.

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

wordhoard-1.4.8.tar.gz (237.1 kB view details)

Uploaded Source

Built Distribution

wordhoard-1.4.8-py3-none-any.whl (247.3 kB view details)

Uploaded Python 3

File details

Details for the file wordhoard-1.4.8.tar.gz.

File metadata

  • Download URL: wordhoard-1.4.8.tar.gz
  • Upload date:
  • Size: 237.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for wordhoard-1.4.8.tar.gz
Algorithm Hash digest
SHA256 5ccbd8da54d7be04f9337c1b6cb737dd008b347177822122cfe62e6bc2402655
MD5 7703276b4fa9d82d8c5760afaa3ece78
BLAKE2b-256 70a9e9993a3d9c92afda766dbfbd553f9e3c850916a7c56d7cdf177ffc6abf56

See more details on using hashes here.

File details

Details for the file wordhoard-1.4.8-py3-none-any.whl.

File metadata

  • Download URL: wordhoard-1.4.8-py3-none-any.whl
  • Upload date:
  • Size: 247.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.5.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.6

File hashes

Hashes for wordhoard-1.4.8-py3-none-any.whl
Algorithm Hash digest
SHA256 167ef6041eb7cc148c32edb0c103eb9e0993d31da2544247c0010a3e061fe922
MD5 abe2ba16eaeddb930aa0161e91be7aa1
BLAKE2b-256 9d956d9b7670a5113398e22836c430df5e0bb4a674aa99cbacd923b0552de3e5

See more details on using hashes here.

Supported by

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