public class PhraseMatcher extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PhraseMatcher.Phrase
Points to a collection of word items (one or more)
which is matches a complete listing in an automat
|
Constructor and Description |
---|
PhraseMatcher(com.yahoo.fsa.FSA phraseAutomatonFSA,
boolean ignorePluralForm)
Creates a phrase matcher
|
PhraseMatcher(String phraseAutomatonFile)
Creates a phrase matcher.
|
PhraseMatcher(String phraseAutomatonFile,
boolean ignorePluralForm)
Creates a phrase matcher
|
Modifier and Type | Method and Description |
---|---|
static PhraseMatcher |
getNullMatcher()
Returns a phrase matcher which (quickly) never matches anything
|
boolean |
isEmpty() |
List<PhraseMatcher.Phrase> |
matchPhrases(Item queryItem)
Finds all phrases (word sequences of length 1 or higher)
of the same index, not negative items of a notitem,
which constitutes a complete entry in the automaton of this matcher
|
void |
setIgnorePluralForm(boolean ignorePluralForm)
Sets whether we should ignore plural/singular form when matching
|
void |
setMatchAll(boolean matchAll)
Sets whether to return the longest matching phrase when there are overlapping matches (default),
or all matching phrases
|
void |
setMatchPhraseItems(boolean matchPhraseItems)
Set whether to match words contained in phrase items as well.
|
void |
setMatchSingleItems(boolean matchSingleItems)
Sets whether single items should be matched and returned as phrase matches.
|
public PhraseMatcher(String phraseAutomatonFile)
phraseAutomatonFile
- the file containing phrases to matchIllegalArgumentException
- if the file is not foundpublic PhraseMatcher(String phraseAutomatonFile, boolean ignorePluralForm)
phraseAutomatonFile
- the file containing phrases to matchignorePluralForm
- whether we should ignore plural and singular forms as matchesIllegalArgumentException
- if the file is not foundpublic PhraseMatcher(com.yahoo.fsa.FSA phraseAutomatonFSA, boolean ignorePluralForm)
phraseAutomatonFSA
- the fsa containing phrases to matchignorePluralForm
- whether we should ignore plural and singular forms as matchesIllegalArgumentException
- if FSA is nullpublic boolean isEmpty()
public void setMatchPhraseItems(boolean matchPhraseItems)
public void setMatchSingleItems(boolean matchSingleItems)
public void setIgnorePluralForm(boolean ignorePluralForm)
public void setMatchAll(boolean matchAll)
public List<PhraseMatcher.Phrase> matchPhrases(Item queryItem)
queryItem
- the root query item in which to match phrasespublic static PhraseMatcher getNullMatcher()
Copyright © 2018. All rights reserved.