pycrossword  0.3
Pure-Python implementation of a crossword puzzle generator and editor
Public Member Functions | Public Attributes | List of all members
pycross.utils.onlineservices.OnlineDictionary Class Reference
Inheritance diagram for pycross.utils.onlineservices.OnlineDictionary:
pycross.utils.onlineservices.MWDict pycross.utils.onlineservices.YandexDict

Public Member Functions

def __init__ (self, settings, url_template='', timeout=5000)
 
def prepare_request_url (self, word)
 
def get_definitions (self, word, method='json')
 
def get_short_defs (self, word, exact_match=True, partsofspeech=None, bad_pos='UNKNOWN')
 

Public Attributes

 url
 
 timeout
 
 settings
 

Constructor & Destructor Documentation

◆ __init__()

def pycross.utils.onlineservices.OnlineDictionary.__init__ (   self,
  settings,
  url_template = '',
  timeout = 5000 
)

Member Function Documentation

◆ get_definitions()

def pycross.utils.onlineservices.OnlineDictionary.get_definitions (   self,
  word,
  method = 'json' 
)
Returns full definitions for 'word' in JSON (python object) or raw text format.

◆ get_short_defs()

def pycross.utils.onlineservices.OnlineDictionary.get_short_defs (   self,
  word,
  exact_match = True,
  partsofspeech = None,
  bad_pos = 'UNKNOWN' 
)
Returns the abridged definition for the given entry.
Params:
- word [str]: the word query
- exact_match [bool]: if True, only defitions for the exact word given by 'word' will be returned
- partsofspeech [list or tuple]: parts of speech to get definitions for
(None = all available)
- bad_pos [str]: substitution for part of speech if unavailable        
Returns:
- list of short definitions in the format:
[('word', 'part of speech', [list of defs], 'url'), ...]

Reimplemented in pycross.utils.onlineservices.YandexDict, and pycross.utils.onlineservices.MWDict.

◆ prepare_request_url()

def pycross.utils.onlineservices.OnlineDictionary.prepare_request_url (   self,
  word 
)

Member Data Documentation

◆ settings

pycross.utils.onlineservices.OnlineDictionary.settings

◆ timeout

pycross.utils.onlineservices.OnlineDictionary.timeout

◆ url

pycross.utils.onlineservices.OnlineDictionary.url

The documentation for this class was generated from the following file: