Package Gnumed :: Package pycommon :: Module gmMatchProvider :: Class cMatchProvider
[frames] | no frames]

Class cMatchProvider

source code

object --+
         |
        cMatchProvider
Known Subclasses:

Base class for match providing objects.

Match sources might be:
- database tables
- flat files
- previous input
- config files
- in-memory list created on the fly

Instance Methods
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
getAllMatches(self) source code
 
getMatches(self, aFragment=None)
Return matches according to aFragment and matching thresholds.
source code
 
getMatchesByPhrase(self, aFragment) source code
 
getMatchesBySubstr(self, aFragment) source code
 
getMatchesByWord(self, aFragment) source code
 
get_match_by_data(self, data=None) source code
 
setThresholds(self, aPhrase=1, aWord=3, aSubstring=5)
Set match location thresholds.
source code
 
set_context(self, context=None, val=None)
Set value to provide context information for matches.
source code
 
unset_context(self, context=None) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  print_queries = False
Properties
  ignored_chars
  word_separators

Inherited from object: __class__

Method Details

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

getMatches(self, aFragment=None)

source code 
Return matches according to aFragment and matching thresholds.

FIXME: design decision: we dont worry about data source changes
           during the lifetime of a MatchProvider
FIXME: append _("*get all items*") on truncation

setThresholds(self, aPhrase=1, aWord=3, aSubstring=5)

source code 
Set match location thresholds.

- the fragment passed to getMatches() must contain at least this many
  characters before it triggers a match search at:
  1) phrase_start - start of phrase (first word)
  2) word_start - start of any word within phrase
  3) in_word - _inside_ any word within phrase

set_context(self, context=None, val=None)

source code 
Set value to provide context information        for matches.

The matching code may ignore it depending on its exact
implementation. Names and values of the context depend
on what is being matched.

<context> -- the *placeholder* key *inside* the context
                         definition, not the context *definition* key


Property Details

ignored_chars

Get Method:
_get_ignored_chars(self)
Set Method:
_set_ignored_chars(self, ignored_chars=None)

word_separators

Get Method:
_get_word_separators(self)
Set Method:
_set_word_separators(self, word_separators=None)