Skip to content

Instantly share code, notes, and snippets.

@Hkazanci93
Hkazanci93 / gist:4b0ec2d7b75dba3f7cb385207d85f6d7
Created October 19, 2021 11:46
Finding the most scored articles
app.py uses zrangebyscore(f"edges_scored:{edges_query}",'-inf','inf',0,5)
import httpimport
with httpimport.remote_repo(['stop_words'], "https://raw.githubusercontent.com/explosion/spaCy/master/spacy/lang/en/"):
import stop_words
from stop_words import STOP_WORDS
with httpimport.remote_repo(['utils'], "https://raw.githubusercontent.com/redis-developer/the-pattern-automata/main/automata/"):
import utils
from utils import loadAutomata, find_matches
@Hkazanci93
Hkazanci93 / gist:974c4c90f450991699cdd44b347f845c
Created October 19, 2021 11:51
Question from RedisGears + RedisAI
get "bertqa{5M5}_PMC140314.xml:{5M5}:44_When air samples collected?"
@Hkazanci93
Hkazanci93 / gist:fd86c49636b881c64dae3808c04d7c7f
Created October 19, 2021 11:52
Capturing the keymiss event
gb = GB('KeysReader')
gb.map(qa_cached_keymiss)
gb.register(prefix='bertqa*', commands=['get'], eventTypes=['keymiss'], mode="async_local")
@Hkazanci93
Hkazanci93 / gist:f90d8adbe10c19d7e393f319356cad3e
Created October 19, 2021 11:54
Updating hash in RedisGraph
redis_client.hset(f"article_id:{article_id}",mapping={'summary': output})
git clone --recurse-submodules https://github.com/redis-developer/the-pattern.git
cd the-pattern
./start.sh
cd ./the-pattern-platform/
source ~/venv_cord19/bin/activate #or create new venv
pip install -r requirements.txt
bash cluster_pipeline.sh
redis-cli -p 9001 -h 127.0.0.1 GRAPH.QUERY cord19medical "MATCH (n:entity) RETURN count(n) as entity_count"
redis-cli -p 9001 -h 127.0.0.1 GRAPH.QUERY cord19medical "MATCH (e:entity)-[r]->(t:entity) RETURN count(r) as edge_count"
redis-cli -p 9001 -h 127.0.0.1 GRAPH.QUERY cord19medical "MATCH (n:entity) RETURN count(n) as entity_count"
redis-cli -p 9001 -h 127.0.0.1 GRAPH.QUERY cord19medical "MATCH (e:entity)-[r]->(t:entity) RETURN count(r) as edge_count"
redis-cli -p 9001 -h 127.0.0.1 GRAPH.QUERY cord19medical "MATCH (n:entity) RETURN count(n) as entity_count"
redis-cli -p 9001 -h 127.0.0.1 GRAPH.QUERY cord19medical "MATCH (e:entity)-[r]->(t:entity) RETURN count(r) as edge_count"
redis-cli -p 9001 -h 127.0.0.1 GRAPH.QUERY cord19medical "MATCH (n:entity) RETURN count(n) as entity_count"
redis-cli -p 9001 -h 127.0.0.1 GRAPH.QUERY cord19medical "MATCH (e:entity)-[r]->(t:entity) RETURN count(r) as edge_count"