This file contains 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 characters
redis_client.hset(f"article_id:{article_id}",mapping={'title': each_line['title']}) | |
redis_client.hset(f"article_id:{article_id}",mapping={'publication_date':each_line['publish_time']}) |
This file contains 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 characters
gb = GB('KeysReader') | |
gb.filter(filter_language) | |
gb.flatmap(parse_paragraphs) | |
gb.map(spellcheck_sentences) | |
gb.foreach(save_sentences) | |
gb.count() | |
gb.register('paragraphs:*',keyTypes=['string','hash'], mode="async_local") |
This file contains 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 characters
rediscluster_client.set(f”paragraphs:{article_id}“,” “.join(article_body)) |
This file contains 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 characters
bg = GearsBuilder('KeysReader') | |
bg.foreach(process_item) | |
bg.count() | |
bg.register('sentence:*', mode="async_local",onRegistered=OnRegisteredAutomata) |
This file contains 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 characters
bg = GearsBuilder('KeysReader') | |
bg.foreach(process_item) | |
bg.count() | |
bg.register('sentence:*', mode="async_local",onRegistered=OnRegisteredAutomata) |
This file contains 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 characters
'XADD', 'edges_matched_{%s}' % shard_id, '*','source',f'{source_entity_id}','destination',f'{destination_entity_id}','source_name',source_canonical_name,'destination_name',destination_canonical_name,'rank',1,'year',year) |
This file contains 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 characters
zincrby(f'edges_scored:{source_entity_id}:{destination_entity_id}',1, sentence_key) |
This file contains 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 characters
"GRAPH.QUERY", "cord19medical","""MERGE (source: entity { id: '%s', label :'entity', name: '%s'}) | |
ON CREATE SET source.rank=1 | |
ON MATCH SET source.rank=(source.rank+1) | |
MERGE (destination: entity { id: '%s', label: 'entity', name: '%s' }) | |
ON CREATE SET destination.rank=1 | |
ON MATCH SET destination.rank=(destination.rank+1) | |
MERGE (source)-[r:related]->(destination) | |
ON CREATE SET r.rank=1, r.year=%s | |
ON MATCH SET r.rank=(r.rank+1) | |
ON CREATE SET r.rank=1 |
This file contains 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 characters
"WITH $ids as ids MATCH (e:entity)-[r]->(t:entity) where (e.id in ids) and (r.year in $years) RETURN DISTINCT e.id, t.id, max(r.rank), r.year ORDER BY r.rank DESC LIMIT $limits""" |
This file contains 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 characters
"""WITH $ids as ids MATCH (e:entity) where (e.id in ids) RETURN DISTINCT e.id,e.name,max(e.rank)""" |
OlderNewer