public class MatchKeywords
extends java.lang.Object
Constructor and Description |
---|
MatchKeywords()
Create a new instance of MatchKeywords.
|
Modifier and Type | Method and Description |
---|---|
float |
compareKeywordCounts(java.util.ArrayList<java.lang.String[]> compareWith,
java.util.ArrayList<java.lang.String[]> keywords)
Compare the word counts in the model passed in with this one.
|
protected float |
compareKeywords(java.util.ArrayList<java.lang.String> compareWith,
java.util.ArrayList<java.lang.String> keywords)
Compare the keyword lists and check for similarity.
|
float |
compareMetadata(java.util.ArrayList<java.lang.String> compareWith,
java.util.ArrayList<java.lang.String> keywords,
java.lang.String matchType)
Compare the metadata as keyword lists and return the result.
|
float |
listsMatch(java.util.ArrayList<java.lang.String> compareWith,
java.util.ArrayList<java.lang.String> keywords)
Compare the keyword lists and check that both contain the same keywords.
|
public float compareMetadata(java.util.ArrayList<java.lang.String> compareWith, java.util.ArrayList<java.lang.String> keywords, java.lang.String matchType) throws java.lang.Exception
MetaConst
.ANYSTRUCTURE
: returns 1.0 for any match.MetaConst
.ALLPARTIAL
: the keyword must be present in both lists
but a matching position is not required. Returns 1.0 for a full match or 0.5 if values or parts
of values are missing.MetaConst
.ALLEXACT
: the keyword must be present in both lists
and also in the same position. Returns 1.0 for a full match or 0.5 if values or parts
of values are missing.compareWith
- the list of keywords to compare with.keywords
- the list of keywords.matchType
- the type of matching process. If null, then MetaConst
.ALLEXACT
is used.java.lang.Exception
- any error.protected float compareKeywords(java.util.ArrayList<java.lang.String> compareWith, java.util.ArrayList<java.lang.String> keywords)
compareWith
- this is the list to compare with. Each item is a word name that can
be in order.keywords
- the word or keyword list. This has the same list structure.public float compareKeywordCounts(java.util.ArrayList<java.lang.String[]> compareWith, java.util.ArrayList<java.lang.String[]> keywords)
compareWith
- the word or term list to compare with. Each item is an array, where
the first element is the word name and the second is a frequency count for the word.
The frequency count is then converted into a number.keywords
- this is the list of keywords and counts. This has the same count structure.public float listsMatch(java.util.ArrayList<java.lang.String> compareWith, java.util.ArrayList<java.lang.String> keywords) throws java.lang.Exception
compareWith
- this is the list to compare with. Each item is a word name that can
be in order.keywords
- the word or keyword list. This has the same list structure.java.lang.Exception
- any error.