com.raritantechnologies.concept.classifier
Class BasicDocumentMatcher

java.lang.Object
  extended bycom.raritantechnologies.concept.classifier.BasicDocumentMatcher
All Implemented Interfaces:
IConfigurable, IDocumentMatcher, ITermExtractor
Direct Known Subclasses:
AccrueDocumentMatcher, AndDocumentMatcher, AndNotDocumentMatcher, CompositeDocumentMatcher, CountDocumentMatcher, FieldValueMatcher, NearDocumentMatcher, NotDocumentMatcher, OrDocumentMatcher, PhraseDocumentMatcher, RangeDocumentMatcher, TermDocumentMatcher, WildcardDocumentMatcher

public abstract class BasicDocumentMatcher
extends java.lang.Object
implements IDocumentMatcher

Base class for IDocumentMatcher implementations.


Developed by Raritan Technologies Inc..

Author:
Ted Sullivan

Constructor Summary
BasicDocumentMatcher()
           
 
Method Summary
 void addAttribute(java.lang.String attrName, java.lang.Object attrValue)
          DocumentMatcher attributes: These are what are added to documents that are matched by the IDocumentMatcher i.e.
protected  void addTerms(java.util.Map tempMap, java.util.Map termsMap)
           
 void addTermsAsAttributes(java.lang.String termAttribute, java.lang.String delimiter)
          Calling this method will cause all of the Terms and Phrases contained in this matcher to be added as a matcher attribute or "tag".
protected abstract  void collectPhraseSet(java.util.HashSet phraseSet)
           
protected abstract  void collectTermSet(java.util.HashSet termSet)
           
abstract  void extractTerms(IndexedDocument fromDocument, java.util.HashMap termsMap)
          Extracts the matching terms contained in the document.
 java.util.Map extractTerms(java.lang.String sessionID, java.lang.String fromString)
          returns a map of terms - key is the term, value is either an AttributeWordsTagger or an Attribute string
 java.lang.Object getAttribute(java.lang.String attrName)
           
 java.util.Iterator getAttributeNames()
           
 DocumentMatchBean getMatchCriteria(IndexedDocument document)
          base class method: sets matches to value of matches( ) method.
 DocumentMatchBean getMatchCriteria(IndexedDocument document, java.util.Map termsMap)
          returns a DocumentMatchBean containing the match criteria (the category or categories that specify the 'reason' or context of the match.
 java.lang.String getName()
           
 java.util.Set getPhraseSet()
          returns the list of phrases in all contained PhraseDocumentMatchers
 java.util.Set getTermSet()
          returns the list of terms in all contained TermDocumentMatchers
 boolean isStopWord(IndexedDocument document)
          Adds stop word support.
abstract  boolean matches(IndexedDocument document)
          returns true if the matcher matches the IndexedDocument, false otherwise.
 void setName(java.lang.String name)
          Unique key that identifies this IDocumentMatcher
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.raritantechnologies.concept.classifier.IDocumentMatcher
extractTerms, render
 
Methods inherited from interface com.raritantechnologies.searchApp.IConfigurable
initialize
 

Constructor Detail

BasicDocumentMatcher

public BasicDocumentMatcher()
Method Detail

matches

public abstract boolean matches(IndexedDocument document)
Description copied from interface: IDocumentMatcher
returns true if the matcher matches the IndexedDocument, false otherwise.

Specified by:
matches in interface IDocumentMatcher

getTermSet

public java.util.Set getTermSet()
Description copied from interface: IDocumentMatcher
returns the list of terms in all contained TermDocumentMatchers

Specified by:
getTermSet in interface IDocumentMatcher

getPhraseSet

public java.util.Set getPhraseSet()
Description copied from interface: IDocumentMatcher
returns the list of phrases in all contained PhraseDocumentMatchers

Specified by:
getPhraseSet in interface IDocumentMatcher

extractTerms

public java.util.Map extractTerms(java.lang.String sessionID,
                                  java.lang.String fromString)
Description copied from interface: ITermExtractor
returns a map of terms - key is the term, value is either an AttributeWordsTagger or an Attribute string

Specified by:
extractTerms in interface ITermExtractor

extractTerms

public abstract void extractTerms(IndexedDocument fromDocument,
                                  java.util.HashMap termsMap)
Description copied from interface: IDocumentMatcher
Extracts the matching terms contained in the document.

Specified by:
extractTerms in interface IDocumentMatcher
Parameters:
fromDocument - The Document to be processed
termsMap - The map into which the extracted terms should be put. The key of the map is the term that hit. The value is an AttributeWordTagger that can be used to mark up the document.

collectTermSet

protected abstract void collectTermSet(java.util.HashSet termSet)

collectPhraseSet

protected abstract void collectPhraseSet(java.util.HashSet phraseSet)

addTerms

protected void addTerms(java.util.Map tempMap,
                        java.util.Map termsMap)

setName

public void setName(java.lang.String name)
Description copied from interface: IDocumentMatcher
Unique key that identifies this IDocumentMatcher

Specified by:
setName in interface IDocumentMatcher

getName

public java.lang.String getName()
Specified by:
getName in interface IDocumentMatcher

getMatchCriteria

public DocumentMatchBean getMatchCriteria(IndexedDocument document)
base class method: sets matches to value of matches( ) method. sets score to 1.0 if matches, 0.0 otherwise.

Specified by:
getMatchCriteria in interface IDocumentMatcher

getMatchCriteria

public DocumentMatchBean getMatchCriteria(IndexedDocument document,
                                          java.util.Map termsMap)
Description copied from interface: IDocumentMatcher
returns a DocumentMatchBean containing the match criteria (the category or categories that specify the 'reason' or context of the match. Adds any contained terms or phrases to the termsMap

Specified by:
getMatchCriteria in interface IDocumentMatcher

addAttribute

public void addAttribute(java.lang.String attrName,
                         java.lang.Object attrValue)
Description copied from interface: IDocumentMatcher
DocumentMatcher attributes: These are what are added to documents that are matched by the IDocumentMatcher i.e. "tags".

Specified by:
addAttribute in interface IDocumentMatcher

getAttribute

public java.lang.Object getAttribute(java.lang.String attrName)
Specified by:
getAttribute in interface IDocumentMatcher

getAttributeNames

public java.util.Iterator getAttributeNames()
Specified by:
getAttributeNames in interface IDocumentMatcher

addTermsAsAttributes

public void addTermsAsAttributes(java.lang.String termAttribute,
                                 java.lang.String delimiter)
Description copied from interface: IDocumentMatcher
Calling this method will cause all of the Terms and Phrases contained in this matcher to be added as a matcher attribute or "tag".

Specified by:
addTermsAsAttributes in interface IDocumentMatcher

isStopWord

public boolean isStopWord(IndexedDocument document)
Description copied from interface: IDocumentMatcher
Adds stop word support. This is typically done by checking if the matchers terms are stop words by calling the IndexedDocument method isStopWord( string ). See TermDocumentMatcher.

Specified by:
isStopWord in interface IDocumentMatcher