### Install ThinkableType from NPM Source: https://thinkabletype.com/ Install the ThinkableType library from NPM. ```bash npm install @themaximalist/thinkabletype ``` -------------------------------- ### Direct Connect hyperedge example Source: https://thinkabletype.com/ A CSV example where a two-node hyperedge (B,2) links every instance of B to every instance of 2, connecting the other edges. ```csv A,B,C 1,2,3 B,2 ``` -------------------------------- ### Interwingle Fusion visualization Source: https://thinkabletype.com/ Use INTERWINGLE.FUSION to connect starts, ends, and direct connections. Fusion automatically includes Confluence. ```javascript const thinkabletype = new ThinkableType({ interwingle: ThinkableType.INTERWINGLE.FUSION, hyperedges: [ ["Plato", "student", "Socrates"], ["Aristotle", "student", "Plato"], ], }); // start and end nodes are fused together const data = thinkabletype.graphData(); // Aristotle -> student -> Plato -> student -> Socrates ``` -------------------------------- ### ThinkableType CSV file with multiple connections Source: https://thinkabletype.com/ Example CSV file with multiple connected ideas. This file is read, parsed, and used to create a knowledge graph with proper connections. ```text Ted Nelson,invented,HyperText Tim Berners-Lee,invented,WWW HyperText,influenced,WWW ``` -------------------------------- ### Basic ThinkableType connection Source: https://thinkabletype.com/ Basic ThinkableType example showing a single connection between two symbols, separated by commas. ```text Ted Nelson,invented,HyperText ``` -------------------------------- ### Filter Hyperedges with filter() Source: https://thinkabletype.com/ Filters hyperedges by symbol, predicate, or both. The `filter` method returns an array of matching hyperedges; the example shows counts for each filter. ```javascript const thinkabletype = new ThinkableType({ hyperedges: [ ["Ted Nelson", "invented", "Xanadu"], ["Tim Berners-Lee", "invented", "WWW"], ["Tim Berners-Lee", "author", "Weaving the Web"], // ... ], }); thinkabletype.filter("invented").length; // 2 thinkabletype.filter("Tim Berners-Lee").length; // 2 thinkabletype.filter("Tim Berners-Lee", "invented").length; // 1 ``` -------------------------------- ### Generate Hyperedges with generate() Source: https://thinkabletype.com/ Generates hyperedges based on a prompt using an LLM. Configure the `llm` option similarly to AI Auto Suggest. The `generate()` method returns hyperedges as CSV-like strings. ```javascript const options = { llm: { service: "openai", model: "gpt-4-turbo-preview", apikey: process.env.OPENAI_API_KEY, }, }; const thinkabletype = new ThinkableType(options); const hyperedges = thinkabletype.generate("Steve Jobs"); // Steve Jobs,Apple Inc,CEO // Steve Jobs,NeXT,Founder // Steve Jobs,Macintosh,Personal Computers // Steve Jobs,iPad,Tablet Computing // ... ``` -------------------------------- ### Build a Hyperedge symbol by symbol Source: https://thinkabletype.com/ Build a Hyperedge one symbol at a time using the add() method on the returned edge object. ```javascript const edge = thinkabletype.add("Vannevar Bush"); edge.add("invented"); edge.add("Memex"); ``` -------------------------------- ### AI Auto Suggest with suggest() Source: https://thinkabletype.com/ Autocompletes symbols or edges using an LLM. Configure the `llm` option with a service, model, and API key (e.g., OpenAI). The `suggest()` method returns an array of suggested symbols. ```javascript const options = { llm: { service: "openai", model: "gpt-4-turbo-preview" apikey: process.env.OPENAI_API_KEY } }; const thinkabletype = new ThinkableType(options); const hyperedge = thinkabletype.add("Steve Jobs", "inventor"); thinkabletype.suggest(); // ["iPhone", "Macintosh", "iPod", ... ] ``` -------------------------------- ### Initialize ThinkableType with hyperedges Source: https://thinkabletype.com/ Initialize ThinkableType with an existing list of hyperedges (nodes and connections). ```javascript const hyperedges = [ ["Plato", "student", "Socrates"], ["Aristotle", "student", "Plato"] ]; const thinkabletype = new ThinkableType({ hyperedges }); ``` -------------------------------- ### Visualize ThinkableType with Force Graph 3D Source: https://thinkabletype.com/ Generate graph data for Force Graph 3D visualization using graphData(). ```javascript const thinkabletype = new ThinkableType({ hyperedges: [ ["Hercules", "son", "Zeus"], ["Hercules", "son", "Alcmene"], ], }); const data = thinkabletype.graphData(); // { nodes, links } for Force Graph 3D ``` -------------------------------- ### Compute PageRank with ThinkableType Source: https://thinkabletype.com/ Runs PageRank on a knowledge graph parsed from CSV-like text. Requires calling `await thinkabletype.sync()` (or `syncPagerank()`) to compute pageranks in the background; results are available via `pageranks` and `pagerank(symbol)`. ```javascript const thinkabletype = ThinkableType.parse(`A,B,C A,B,D A,B,E A,C,Z`); await thinkabletype.sync(); // syncs pagerank thinkabletype.pageranks // { A: , B: , ... } thinkabletype.pagerank("Z") // { A: , C: , ... } ``` -------------------------------- ### Build ThinkableType programmatically Source: https://thinkabletype.com/ Build a ThinkableType file programmatically by adding hyperedges with the add() method. ```javascript const thinkabletype = new ThinkableType(); thinkabletype.add("Vannevar Bush", "author", "As We May Think"); thinkabletype.add("Ted Nelson", "invented", "HyperText"); thinkabletype.add("As We May Think", "influenced", "HyperText"); ``` -------------------------------- ### Load ThinkableType file from CSV Source: https://thinkabletype.com/ Import an existing .csv file using ThinkableType.parse(). Optionally specify a custom delimiter in the parse options. ```javascript import ThinkableType from "@themaximalist/thinkabletype" const thinkabletype = ThinkableType.parse("ancient_sumerians.csv"); // or specify a different separator const thinkabletype = ThinkableType.parse("secret_research_project.csv", { parse: { delimiter: " -> " } }); ``` -------------------------------- ### Find Similar Hyperedges with edge.similar() Source: https://thinkabletype.com/ Finds hyperedges similar to a given hyperedge based on symbol similarity. Requires `await thinkabletype.sync()` first. Returns an array of `Hyperedge` objects. ```javascript const thinkabletype = new ThinkableType(); const edge1 = thinkabletype.add("Red", "Green", "Blue"); const edge2 = thinkabletype.add("Red", "White", "Blue"); const edge3 = thinkabletype.add("Bob", "Sally", "Bill"); await thinkabletype.sync(); await edge1.similar(); // [ Hyperedge("Red", "White", "Blue") ] await edge2.similar(); // [ Hyperedge("Red", "Green", "Blue") ] ``` -------------------------------- ### Interwingle Bridge visualization Source: https://thinkabletype.com/ Use INTERWINGLE.BRIDGE to connect common symbols with a bridge. Bridge automatically includes Fusion and Confluence. ```javascript const thinkabletype = new ThinkableType({ interwingle: ThinkableType.INTERWINGLE.BRIDGE, hyperedges: [ ["Vannevar Bush", "author", "As We May Think"], ["Ted Nelson", "author", "Computer Lib/Dream Machines"], ["Tim Berners-Lee", "author", "Weaving the Web"], ], }); // common symbols are connected through a bridge const data = thinkabletype.graphData(); // // Vannevar Bush -> author -> As We May Think // | // Ted Nelson -> author -> Computer Lib/Dream Machines // | // Tim Berners-Lee -> author -> Weaving the Web ``` -------------------------------- ### Interwingle Confluence visualization Source: https://thinkabletype.com/ Use INTERWINGLE.CONFLUENCE to connect common parents in the graph. ```javascript const thinkabletype = new ThinkableType({ interwingle: ThinkableType.INTERWINGLE.CONFLUENCE, hyperedges: [ ["Hercules", "son", "Zeus"], ["Hercules", "son", "Alcmene"], ], }); // nodes shares common ancestors const data = thinkabletype.graphData(); // // / Zeus // Herculues -> son // \ Alcmene // ``` -------------------------------- ### CLI Search Command Source: https://thinkabletype.com/ CLI command to search for a term and output hyperedges to stdout. The output is CSV-like lines. By default it writes to stdout; you can redirect to a file. ```bash > thinkabletype epic of gilgamesh epic of gilgamesh,sumerian literature,ancient civilization epic of gilgamesh,gilgamesh,enkidu,immortality,friendship sumerian literature,cuneiform writing,mesopotamia ... ``` -------------------------------- ### Interwingle Isolated visualization Source: https://thinkabletype.com/ Use INTERWINGLE.ISOLATED to display hyperedges exactly as entered, with no interconnections. ```javascript const thinkabletype = new ThinkableType({ interwingle: ThinkableType.INTERWINGLE.ISOLATED, hyperedges: [ ["Hercules", "son", "Zeus"], ["Hercules", "son", "Alcmene"], ], }); // hyperedges are displayed exactly as entered const data = thinkabletype.graphData(); // Hercules -> son -> Zeus // Hercules -> son -> Alcmene ``` -------------------------------- ### Redirect CLI Output to CSV Source: https://thinkabletype.com/ Redirects the CLI output to a CSV file. This is an alternative to copying and pasting from stdout. ```bash > thinkabletype mesopotamia > mesopotamia.csv ``` -------------------------------- ### Find Similar Symbols with similarSymbols Source: https://thinkabletype.com/ Finds symbols similar to a given text using local embeddings and vector search. Requires `await thinkabletype.sync()` first. Returns an array of objects with `symbol` and `distance`. ```javascript const thinkabletype = ThinkableType.parse(`Red,Green,Blue White,Black,Gray`); await thinkabletype.sync(); await thinkabletype.similarSymbols("Redish"); // [ { symbol: "Red": distance: 0.5 } ] ``` -------------------------------- ### ThinkableType connection with arrow syntax Source: https://thinkabletype.com/ Alternative syntax using arrows (->) to represent connections in ThinkableType. ```text Tim Berners-Lee -> invented -> WWW ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.