| |
- SearchEngine
class SearchEngine |
|
This class provides specific search funtionalities for the LRA
system. That involves methods to count word pairs in a certain scope,
to search for phrases in a certain scope (with a minimum and a maximum
of intervening words), and to count pattern matchings in phrases that
were found before (caching).
The class uses the CorpusInterface of the corpus module to perform
context search operations. |
|
Methods defined here:
- __init__(self, directory)
- cacheInterPhrases(self, word1, word2, minInter, maxInter)
- Caches a list of phrases, that intervene between two words.
The phrase length must be at least <minInter>, and must not be
bigger than <maxInter>. The occurrence order of the two words is
irrelevant. Suffixes are ignored when searching for the words.
- countPatternForWordPair(self, pattern, word1, word2)
- Returns the number of matches of <pattern> in the the corpus for
<word1> <pattern> <word2>.
<pattern> is a string containing words or wildcards for words ("*")
that are split by whitespace.
The pairPhraseDict is used to count the patterns, thus the method
cacheInterPhrases must be called before using this method.
- countWordPairInScope(self, word1, word2, scope)
- Returns the number of occurrences of two words in a certain scope,
while saving the intervening phrases in the cache.
- getCachedPhrases(self)
- Returns all intervening phrases of all word pairs previously
searched for.
The pairPhraseDict is used to get the phrases, thus the method
cacheInterPhrases must be called before using this method.
- getCachedPhrasesForWordPair(self, word1, word2)
- Returns all intervening phrases of a word pair in given and
flipped order.
The pairPhraseDict is used to get the phrases, thus the method
cacheInterPhrases must be called before using this method.
| |