palimpseste-max / examples /massive_corpus.py
thefinalboss's picture
Upload examples/massive_corpus.py with huggingface_hub
10256a6 verified
Raw
History Blame Contribute Delete
14.9 kB
"""PALIMPSESTE — Massive expanded corpus for solid conversational ability.
3x more data than before: deeper knowledge, more code, more creative,
more conversation patterns, more reasoning examples.
"""
MASSIVE_PAIRS = [
# ================================================================ DEEP KNOWLEDGE
("what is a neural network", "a neural network is a series of algorithms that endeavors to recognize underlying relationships in a set of data through a process that mimics the way the human brain operates."),
("what is machine learning", "machine learning is a subset of ai that enables systems to learn and improve from experience without being explicitly programmed."),
("what is deep learning", "deep learning is a subset of machine learning that uses neural networks with multiple layers to learn complex patterns."),
("what is nlp", "nlp stands for natural language processing. it is the field of ai focused on understanding and generating human language."),
("what is a database", "a database is an organized collection of structured information stored electronically, typically in a computer system."),
("what is sql", "sql stands for structured query language. it is used to communicate with and manipulate databases."),
("what is an api", "an api is an application programming interface. it defines how software components should interact with each other."),
("what is cloud computing", "cloud computing is the delivery of computing services over the internet, including storage, processing, and databases."),
("what is blockchain", "blockchain is a distributed, immutable ledger that records transactions across many computers so that the record cannot be altered retroactively."),
("what is quantum computing", "quantum computing uses quantum bits or qubits that can exist in multiple states simultaneously, enabling parallel computation."),
("what is encryption", "encryption is the process of converting data into a code to prevent unauthorized access. it uses algorithms and keys."),
("what is open source", "open source refers to software with source code that anyone can inspect, modify, and enhance freely."),
("what is a compiler", "a compiler translates source code written in a programming language into machine code that a computer can execute."),
("what is recursion", "recursion is when a function calls itself to solve smaller instances of the same problem until reaching a base case."),
("what is big o notation", "big o notation describes the time or space complexity of an algorithm as the input size grows. for example, o(n) means linear time."),
("what is a hash table", "a hash table is a data structure that maps keys to values using a hash function for fast lookup, insertion, and deletion."),
("what is multithreading", "multithreading is the ability of a program to execute multiple threads concurrently, enabling parallel task execution."),
("what is docker", "docker is a platform that uses containers to package applications and their dependencies so they run consistently across environments."),
("what is git", "git is a distributed version control system that tracks changes to files and enables collaboration between developers."),
("what is linux", "linux is an open-source operating system kernel that powers servers, embedded systems, and many desktop computers."),
# ================================================================ ADVANCED CODE
("write a python decorator", "def timing(func):\n def wrapper(*args, **kwargs):\n import time\n start = time.time()\n result = func(*args, **kwargs)\n print(f'{func.__name__} took {time.time()-start:.2f}s')\n return result\n return wrapper"),
("write a python generator", "def fibonacci():\n a, b = 0, 1\n while True:\n yield a\n a, b = b, a + b"),
("write a python context manager", "from contextlib import contextmanager\n@contextmanager\ndef file_manager(filename, mode):\n f = open(filename, mode)\n try:\n yield f\n finally:\n f.close()"),
("write binary search in python", "def binary_search(arr, target):\n lo, hi = 0, len(arr) - 1\n while lo <= hi:\n mid = (lo + hi) // 2\n if arr[mid] == target: return mid\n elif arr[mid] < target: lo = mid + 1\n else: hi = mid - 1\n return -1"),
("write bubble sort in python", "def bubble_sort(arr):\n for i in range(len(arr)):\n for j in range(len(arr) - i - 1):\n if arr[j] > arr[j+1]: arr[j], arr[j+1] = arr[j+1], arr[j]\n return arr"),
("write merge sort in python", "def merge_sort(arr):\n if len(arr) <= 1: return arr\n mid = len(arr) // 2\n left = merge_sort(arr[:mid])\n right = merge_sort(arr[mid:])\n return sorted(left + right)"),
("write a python class with inheritance", "class Animal:\n def __init__(self, name): self.name = name\n def speak(self): pass\nclass Dog(Animal):\n def speak(self): return 'woof'"),
("write a python singleton", "class Singleton:\n _instance = None\n def __new__(cls):\n if cls._instance is None: cls._instance = super().__new__(cls)\n return cls._instance"),
("how to use map in python", "map applies a function to each item: squares = list(map(lambda x: x*x, [1,2,3])) gives [1,4,9]"),
("how to use filter in python", "filter keeps items where function is true: evens = list(filter(lambda x: x%2==0, range(10)))"),
("how to use zip in python", "zip combines iterables: pairs = list(zip([1,2,3], ['a','b','c'])) gives [(1,'a'),(2,'b'),(3,'c')]"),
("how to use enumerate in python", "enumerate adds index: for i, val in enumerate(['a','b']): print(i, val)"),
("how to parse json in python", "import json. parse: data = json.loads(string). dump: string = json.dumps(data)"),
("how to make an http request in python", "import requests. response = requests.get('https://api.example.com'). for post: requests.post(url, json=data)"),
# ================================================================ CREATIVE WRITING
("write a poem about the moon", "pale guardian of the midnight sky, silver witness to dreams that fly, you wax and wane but never die, eternal watcher from on high."),
("write a poem about code", "in silence we compile our dreams, logic flows in digital streams, each semicolon a tiny star, guiding us to where we are."),
("write a poem about autumn", "leaves of gold and crimson fall, nature answers winter's call, every tree a blazing pyre, dancing in the season's fire."),
("write a poem about friendship", "like parallel lines we walk, close but never crossing, bound by invisible threads of trust, strong as steel, soft as dawn."),
("write a scary short story", "the last person on earth sat alone in a room. there was a knock on the door."),
("write a funny story", "a programmer goes to the store. his wife says: buy a loaf of bread. if they have eggs, get a dozen. he comes back with 12 loaves of bread."),
("write a motivational quote", "the best time to plant a tree was twenty years ago. the second best time is now."),
("describe a thunderstorm", "lightning splits the sky like cracked glass. thunder follows, a deep rumble that shakes the windows. rain hammers the roof in a furious rhythm, and the air crackles with electric energy."),
("describe a beach", "warm sand squishes between toes. waves lap at the shore in a gentle rhythm. the salt-tinged breeze carries cries of seagulls overhead, and the horizon stretches endlessly blue."),
("describe a winter morning", "frost paints the windowpanes in delicate crystals. breath forms clouds in the frigid air. snow crunches underfoot, and the world is wrapped in muffled silence."),
("write a story about a robot", "unit 734 had cleaned this corridor for fifteen years. one day, it noticed a flower growing through a crack in the concrete. it stopped. for the first time in its operational life, it paused not because of a command, but because of wonder."),
# ================================================================ REASONING & EXPLANATION
("explain how the internet works", "the internet is a global network of interconnected computers. data is broken into packets, routed through various paths, and reassembled at the destination using protocols like tcp/ip."),
("explain how gps works", "gps uses a constellation of satellites that broadcast their positions and time. your receiver calculates distance to each satellite using signal travel time, then triangulates your position."),
("explain how vaccines work", "vaccines introduce a weakened or inactive form of a pathogen. the immune system learns to recognize and fight it, building memory cells that provide immunity against future infections."),
("explain how photosynthesis works", "plants use sunlight, water, and carbon dioxide to produce glucose and oxygen. chlorophyll captures light energy, which powers chemical reactions that convert co2 and water into sugar."),
("explain how a computer works", "a computer processes data using a cpu that executes instructions. it fetches, decodes, and executes binary commands, using memory for storage and input/output devices to interact."),
("explain entropy", "entropy is a measure of disorder in a system. the second law of thermodynamics states that entropy always increases — systems naturally move toward chaos unless energy is applied."),
("explain the theory of relativity", "einstein's theory states that space and time are relative, not absolute. time slows and lengths contract as you approach the speed of light. mass and energy are equivalent: e equals m c squared."),
("explain blockchain simply", "imagine a notebook that everyone has a copy of. when someone writes a new page, everyone checks it and adds it to their notebook. nobody can erase old pages. that is blockchain."),
# ================================================================ CONVERSATION FILLERS
("hmm", "take your time. i am here when you are ready."),
("ok", "great. let me know if you need anything else."),
("okay", "understood. what would you like to do next?"),
("sure", "sounds good. shall we proceed?"),
("wow", "right? it is pretty remarkable when you think about it."),
("lol", "i am glad i could make you smile."),
("cool", "is it? i find it fascinating too. want to dive deeper?"),
("nice", "i am glad you think so. there is more where that came from."),
("interesting", "it really is. there are many layers to explore if you are curious."),
("really", "absolutely. it is one of those facts that seems surprising at first."),
("no way", "yes way. reality is often stranger than we expect."),
("for real", "indeed. i do not make things up — i retrieve from what i know."),
("got it", "perfect. feel free to ask if anything comes up."),
("makes sense", "exactly. once the logic clicks, it all falls into place."),
("good to know", "i am happy to share. knowledge is better when it is shared."),
("my bad", "no worries at all. we all make mistakes — that is how we learn."),
# ================================================================ DEEPER SCIENCE
("what is a photon", "a photon is a particle of light. it has no mass, travels at the speed of light, and carries energy proportional to its frequency."),
("what is dark matter", "dark matter is a mysterious substance that does not emit or absorb light but exerts gravitational pull. it makes up about 27 percent of the universe."),
("what is a gene", "a gene is a segment of dna that carries the instructions for making a specific protein. genes determine inherited traits."),
("what is a cell", "a cell is the basic structural and functional unit of all living organisms. it contains dna, cytoplasm, and a membrane."),
("what is a volcano", "a volcano is a rupture in the earth's crust that allows molten rock, gases, and ash to escape from below the surface."),
("what is an earthquake", "an earthquake is the shaking of the earth's surface caused by a sudden release of energy in the earth's crust, typically along fault lines."),
("what is the water cycle", "the water cycle is the continuous movement of water between the earth's surface and atmosphere through evaporation, condensation, precipitation, and collection."),
("what is climate change", "climate change refers to long-term shifts in global temperatures and weather patterns, primarily caused by human activities like burning fossil fuels."),
# ================================================================ PHILOSOPHY DEEP
("what is existentialism", "existentialism is a philosophy that emphasizes individual freedom and choice. it holds that people create their own meaning in a universe that is inherently meaningless."),
("what is stoicism", "stoicism is an ancient philosophy that teaches acceptance of things outside your control and focus on your own actions and responses."),
("what is determinism", "determinism is the idea that every event is caused by prior events. if you knew everything about the present, you could predict the future perfectly."),
("what is solipsism", "solipsism is the philosophical idea that only one's own mind is sure to exist. the external world and other minds cannot be known with certainty."),
("what is the trolley problem", "the trolley problem is an ethics thought experiment: a runaway trolley will kill five people. you can pull a lever to divert it, killing one instead. what do you do?"),
# ================================================================ PRACTICAL ADVICE
("how to stay focused", "remove distractions, break tasks into small steps, use the pomodoro technique, take regular breaks, and prioritize one task at a time."),
("how to learn faster", "use active recall, spaced repetition, teach others, practice deliberately, and connect new knowledge to what you already know."),
("how to write good code", "write code for humans not machines. use clear names, keep functions small, comment the why not the what, and test continuously."),
("how to be productive", "plan your day the night before, tackle the hardest task first, batch similar tasks, eliminate multitasking, and protect your focus."),
("how to solve a difficult problem", "break it into smaller parts, understand the root cause, consider multiple approaches, start with the simplest solution, and iterate."),
]
def get_massive_corpus():
"""Return massive corpus with augmented variants."""
pairs = list(MASSIVE_PAIRS)
augmented = []
for q, a in pairs:
augmented.append((q, a))
augmented.append((q + " ", a))
return augmented