MCPcopy
hub / github.com/LAION-AI/Open-Assistant / EntityRecognizedSummarizer

Class EntityRecognizedSummarizer

scripts/data_augment/data_augment.py:345–357  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

343
344
345class EntityRecognizedSummarizer(DataAugmenter):
346 def __init__(self):
347 self.nlp = spacy.load("en_core_web_sm") # run !python -m spacy download en_core_web_sm in order to download
348
349 def parse_single(self, essay):
350 ents = recognize_entities(essay, self.nlp)
351 characters = ents.most_common(4, person=True)
352 topic = recognize_entities(essay, self.nlp, n=2, person=False)
353
354 question = f"Please write a story titled {topic} with the characters {characters}."
355 answer = f"Sure. Here is a story titled {topic}\n" + essay
356
357 return [question], [answer]
358
359
360class CodeBugger(DataAugmenter):

Callers 1

get_augmenterFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected