|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.labs.minion.retrieval.parser.Transformer
com.sun.labs.minion.retrieval.parser.StrictTransformer
public class StrictTransformer
This class transforms the output of JavaCC into a tree of query elements that the query evaluator can understand. It's more than meets the eye.
| Constructor Summary | |
|---|---|
StrictTransformer()
|
|
| Method Summary | |
|---|---|
protected static java.util.ArrayList |
collapseAnds(SimpleNode node,
boolean passChildrenUp,
int andType,
int nearVal)
Collapse any AND nodes that are just a chain or similar ANDSs into a single AND node with many children. |
protected static java.util.ArrayList |
collapseOrs(SimpleNode node,
boolean passChildrenUp)
Collapse any OR nodes that are just a chain or ORs into a single OR node with many children. |
protected static java.util.ArrayList |
collapsePassages(SimpleNode node,
boolean passChildrenUp)
Collapse any PASSAGE nodes that have a set of terms in an undefined node down into a single PASSAGE node. |
protected static void |
collapsePhrases(SimpleNode node,
TokenCollectorStage tcs)
Creates phrases for terms that would have been tokenized by the tokenizer upon indexing. |
static java.lang.String |
getFieldName(SimpleNode field)
|
static java.lang.String |
getFieldValue(SimpleNode field)
|
static int |
getOp(SimpleNode field)
|
protected static boolean |
isPassThrough(SimpleNode node)
Determines if the node has any significance or if it is just a passthrough that can be skipped. |
static void |
main(java.lang.String[] args)
|
protected static QueryElement |
makeQueryElements(SimpleNode node,
int defaultOperator)
This recursive method creates the tree of query elements based on the root node passed in. |
static boolean |
opIsAnd(int op)
|
static boolean |
opIsOr(int op)
|
protected static java.util.ArrayList |
removeClutter(SimpleNode node)
Removes clutter nodes -- the nodes that have only a single child and provide no additional context |
QueryElement |
transformTree(SimpleNode root)
Transforms an abstract syntax tree provided by JJTree+JavaCC into a tree of QueryElements that can be used by the query evaluator. |
QueryElement |
transformTree(SimpleNode root,
int defaultOperator)
Transforms an abstract syntax tree provided by JJTree+JavaCC into a tree of QueryElements that can be used by the query evaluator. |
protected static boolean |
validateTors(SimpleNode node)
Checks to make sure that any TOR nodes have only plain terms associated with them. |
| Methods inherited from class com.sun.labs.minion.retrieval.parser.Transformer |
|---|
isDoubleQuoted, isQuoted, isSingleQuoted |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StrictTransformer()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
public QueryElement transformTree(SimpleNode root)
throws java.text.ParseException
transformTree in class Transformerroot - the root node of the tree returned from the Parser
java.text.ParseException
public QueryElement transformTree(SimpleNode root,
int defaultOperator)
throws java.text.ParseException
transformTree in class Transformerroot - the root node of the tree returned from the ParserdefaultOperator - specified the default operator to use when no
other operator is provided between terms in the query. Valid values are
defined in the Searcher interface
java.text.ParseException
protected static QueryElement makeQueryElements(SimpleNode node,
int defaultOperator)
throws java.text.ParseException
node - defaultOperator - specified the default operator to use when no
other operator is provided between terms in the query. Valid values are
defined in the Searcher interface
java.text.ParseExceptionprotected static boolean isPassThrough(SimpleNode node)
node - the node to check
protected static java.util.ArrayList removeClutter(SimpleNode node)
node - the node to clean, pass in the root when calling
externally
protected static boolean validateTors(SimpleNode node)
node - the node to check
protected static java.util.ArrayList collapseOrs(SimpleNode node,
boolean passChildrenUp)
node -
protected static java.util.ArrayList collapseAnds(SimpleNode node,
boolean passChildrenUp,
int andType,
int nearVal)
node -
protected static java.util.ArrayList collapsePassages(SimpleNode node,
boolean passChildrenUp)
node -
protected static void collapsePhrases(SimpleNode node,
TokenCollectorStage tcs)
node - public static boolean opIsOr(int op)
public static boolean opIsAnd(int op)
public static int getOp(SimpleNode field)
throws java.text.ParseException
java.text.ParseException
public static java.lang.String getFieldName(SimpleNode field)
throws java.text.ParseException
java.text.ParseException
public static java.lang.String getFieldValue(SimpleNode field)
throws java.text.ParseException
java.text.ParseException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||