Created
March 14, 2023 15:33
-
-
Save myedibleenso/d35048e1f22d0a7ddac76f11cd3f5326 to your computer and use it in GitHub Desktop.
Revisions
-
myedibleenso created this gist
Mar 14, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ # conda create -n "odinsynth-redux" python=3.9 ipython # clone https://github.com/lum-ai/odinson-gateway # pip install ".[all]" # from the iPython REPL from typing import Dict, Any, List, Text from odinson.gateway import OdinsonGateway, Document import json # FIXME: our specification of Odinson documents. # Assumes these have been loaded as a seq of Python dicts specs: List[Dict[Text, Any]] = [] docs = [Document.from_json(spec) for spec in specs] engine = OdinsonGateway.open_memory_index(docs) # your rule rule: Text = "" results = engine.search(pattern=rule) print(f"total hits: {results.total_hits}") for scoredoc in results.docs: print(f"Lucene doc ID: {scoredoc.doc}") print(f"start: {scoredoc.start}") print(f"end: {scoredoc.end}\n") # also named_captures