sci_watch.parser.query_parser module

class sci_watch.parser.query_parser.CreateCustomTree(visit_tokens: bool = True)[source]

Bases: Transformer

Custom tree transformer class based on Lark Transformers each of the methods below is called on the corresponding clause to create a custom Node

and_clause(nodes) Node[source]
begin_clause(nodes) Node[source]
distance(values) int[source]
expression(values) Node[source]
in_content_clause(nodes) Node[source]
in_title_clause(nodes) Node[source]
not_clause(values) Node[source]
or_clause(nodes) Node[source]
parenthesis_clause(nodes) Node[source]
proximity(values) Node[source]
query(nodes) Node[source]
scoped_query(nodes) Node[source]
scoped_token(nodes) Node[source]
token(nodes) Node[source]
word_with_wildcard(values) Node[source]
sci_watch.parser.query_parser.update_search_scope(tree: Node) None[source]

Given the root node of a tree, traverse it and update the search scope for each node, in place

Parameters:

tree (Node) – Root node of the tree to traverse