pycrossword  0.4
Pure-Python implementation of a crossword puzzle generator and editor
Public Member Functions | Public Attributes | List of all members
pycross.utils.onlineservices.YandexDict Class Reference

Interface for Yandex dictionary. More...

Inheritance diagram for pycross.utils.onlineservices.YandexDict:
pycross.utils.onlineservices.OnlineDictionary

Public Member Functions

def __init__ (self, settings, lang='ru-ru', timeout=5000)
 
def prepare_request_url (self, word)
 Constructs the search URL given a search word. More...
 
def get_short_defs (self, word, exact_match=True, partsofspeech=None, bad_pos='UNKNOWN')
 Returns the abridged definition for the given entry. More...
 
- Public Member Functions inherited from pycross.utils.onlineservices.OnlineDictionary
def get_definitions (self, word, method='json')
 Returns full definitions for 'word' in JSON (python object) or raw text format. More...
 

Public Attributes

 lang
 
- Public Attributes inherited from pycross.utils.onlineservices.OnlineDictionary
 url
 str‘ search URL template with placeholders (’{}') for parameters More...
 
 timeout
 int network request timeout (in msec.) More...
 
 settings
 dict stored pointer to app global settings More...
 

Detailed Description

Interface for Yandex dictionary.

Constructor & Destructor Documentation

◆ __init__()

def pycross.utils.onlineservices.YandexDict.__init__ (   self,
  settings,
  url_template = 'ru-ru',
  timeout = 5000 
)
Parameters
settingsdict pointer to the app settings dictionary (pycross::guisettings::CWSettings::settings)
url_templatestr search URL template with placeholders ('{}') for parameters
timeoutint network request timeout (in msec.)

Reimplemented from pycross.utils.onlineservices.OnlineDictionary.

Member Function Documentation

◆ get_short_defs()

def pycross.utils.onlineservices.YandexDict.get_short_defs (   self,
  word,
  exact_match = True,
  partsofspeech = None,
  bad_pos = 'UNKNOWN' 
)

Returns the abridged definition for the given entry.

Parameters
wordstr the word query
exact_matchbool if True, only defitions for the exact word given by word will be returned
partsofspeechlist|tuple parts of speech to get definitions for (None = all available)
bad_posstr substitution for part of speech if unavailable
Returns
list list of short definitions in the format:
[('word', 'part of speech', [list of defs], 'url'), ...]

Reimplemented from pycross.utils.onlineservices.OnlineDictionary.

◆ prepare_request_url()

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

Constructs the search URL given a search word.

Parameters
wordstr search word
Returns
str prepared search URL

Reimplemented from pycross.utils.onlineservices.OnlineDictionary.

Member Data Documentation

◆ lang

pycross.utils.onlineservices.YandexDict.lang

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