Package com.nuix.superutilities.misc
Class TermExpander
- java.lang.Object
-
- com.nuix.superutilities.misc.TermExpander
-
public class TermExpander extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description TermExpander()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<ExpandedTermInfo>
expandTerm(nuix.Case nuixCase, boolean content, boolean properties, java.lang.String term)
This method "expands" a term to related terms in the specified case.java.util.List<ExpandedTermInfo>
expandTerm(nuix.Case nuixCase, boolean content, boolean properties, java.lang.String term, java.lang.String scopeQuery)
This method "expands" a term to related terms in the specified case.java.util.List<ExpandedTermInfo>
expandTerm(nuix.Case nuixCase, java.lang.String term)
This method "expands" a term to related terms in the specified case.SimilarityCalculation
getFuzzyResolutionAlgorithm()
Gets which method this instance will use to resolve fuzzy terms.void
setFuzzyResolutionAlgorithm(SimilarityCalculation resolutionAlgorithm)
Sets which method this instance will use to resolve fuzzy terms.void
whenProgressUpdated(java.util.function.BiConsumer<java.lang.Integer,java.lang.Integer> callback)
Allows you to provide a callback which will be invoked whenexpandTerm(Case, boolean, boolean, String, String)
(or similar overloads) make progress resolving a given term to matched terms.
-
-
-
Method Detail
-
getFuzzyResolutionAlgorithm
public SimilarityCalculation getFuzzyResolutionAlgorithm()
Gets which method this instance will use to resolve fuzzy terms.- Returns:
- The fuzzy term resolution method
-
setFuzzyResolutionAlgorithm
public void setFuzzyResolutionAlgorithm(SimilarityCalculation resolutionAlgorithm)
Sets which method this instance will use to resolve fuzzy terms.- Parameters:
resolutionAlgorithm
- The fuzzy term resolution method
-
whenProgressUpdated
public void whenProgressUpdated(java.util.function.BiConsumer<java.lang.Integer,java.lang.Integer> callback)
Allows you to provide a callback which will be invoked whenexpandTerm(Case, boolean, boolean, String, String)
(or similar overloads) make progress resolving a given term to matched terms.- Parameters:
callback
- A BiConsumer that accepts 2 Integers, the first being current progress. The second being total progress.
-
expandTerm
public java.util.List<ExpandedTermInfo> expandTerm(nuix.Case nuixCase, java.lang.String term) throws java.lang.Exception
This method "expands" a term to related terms in the specified case. The intent being to get an idea of what a wild card or fuzzy term may be expanding into were it to be used in a query. Its should only be provided single word terms, anything else will likely yield no or undefined results. Term provided may contain wild card matching characters or be a fuzzy term.
Wild card characters are*
(match 0 or more characters) or?
(match a single character). Examples:
ca*
- Example terms: cat, catch, cats, car, cars, caring
*th
- Example terms: math, bath, fourth, fifth, wrath
c?n
- Example terms: con, can, cnn
A fuzzy term may also be provided. A fuzzy term is a term, followed by a tilde and optionally a similarity score. For example:
jason~0.5
- Example terms: json, jevon, jasen, mason, juston, jayson, etc
This version of the method internally callsexpandTerm(Case, boolean, boolean, String, String)
providing true for arguments "content" and "properties" and a null scope query.- Parameters:
nuixCase
- The Nuix case, needed to access case term statisticsterm
- The term to expand upon examples: ca*, *th, c?n, jason~0.5- Returns:
- A list of
ExpandedTermInfo
objects, each containing information about a matched term. - Throws:
java.lang.Exception
- If something goes wrong
-
expandTerm
public java.util.List<ExpandedTermInfo> expandTerm(nuix.Case nuixCase, boolean content, boolean properties, java.lang.String term) throws java.lang.Exception
This method "expands" a term to related terms in the specified case. The intent being to get an idea of what a wild card or fuzzy term may be expanding into were it to be used in a query. Its should only be provided single word terms, anything else will likely yield no or undefined results. Term provided may contain wild card matching characters or be a fuzzy term.
Wild card characters are*
(match 0 or more characters) or?
(match a single character). Examples:
ca*
- Example terms: cat, catch, cats, car, cars, caring
*th
- Example terms: math, bath, fourth, fifth, wrath
c?n
- Example terms: con, can, cnn
A fuzzy term may also be provided. A fuzzy term is a term, followed by a tilde and optionally a similarity score. For example:
jason~0.5
- Example terms: json, jevon, jasen, mason, juston, jayson, etc
This version of the method internally callsexpandTerm(Case, boolean, boolean, String, String)
providing a null for scope query.- Parameters:
nuixCase
- The Nuix case, needed to access case term statisticscontent
- Whether to include terms from item content textproperties
- Whether to include terms from item metadata propertiesterm
- The term to expand upon examples: ca*, *th, c?n, jason~0.5- Returns:
- A list of
ExpandedTermInfo
objects, each containing information about a matched term. - Throws:
java.lang.Exception
- If something goes wrong
-
expandTerm
public java.util.List<ExpandedTermInfo> expandTerm(nuix.Case nuixCase, boolean content, boolean properties, java.lang.String term, java.lang.String scopeQuery) throws java.lang.Exception
This method "expands" a term to related terms in the specified case. The intent being to get an idea of what a wild card or fuzzy term may be expanding into were it to be used in a query. Its should only be provided single word terms, anything else will likely yield no or undefined results. Term provided may contain wild card matching characters or be a fuzzy term.
Wild card characters are*
(match 0 or more characters) or?
(match a single character). Examples:
ca*
- Example terms: cat, catch, cats, car, cars, caring
*th
- Example terms: math, bath, fourth, fifth, wrath
c?n
- Example terms: con, can, cnn
A fuzzy term may also be provided. A fuzzy term is a term, followed by a tilde and optionally a similarity score. For example:
jason~0.5
- Example terms: json, jevon, jasen, mason, juston, jayson, etc- Parameters:
nuixCase
- The Nuix case, needed to access case term statisticscontent
- Whether to include terms from item content textproperties
- Whether to include terms from item metadata propertiesterm
- The term to expand upon examples: ca*, *th, c?n, jason~0.5scopeQuery
- A Nuix query which can be used to limit which items' terms are considered. An empty string or null will be all items in the case.- Returns:
- A list of
ExpandedTermInfo
objects, each containing information about a matched term. - Throws:
java.lang.Exception
- If something goes wrong
-
-