{"library":"nlcst-is-literal","title":"nlcst Literal Node Checker","description":"nlcst-is-literal is a focused utility within the `unified` ecosystem, designed to determine if a `WordNode` within an NLCST (Natural Language Concrete Syntax Tree) parent node is semantically considered a \"literal.\" This check typically involves analyzing surrounding punctuation, such as quotes, parentheses, or dashes, that enclose the word. The package is currently stable at version `3.0.0` and follows the `unified` collective's release cadence, typically aligning major versions with Node.js LTS updates and significant architectural shifts like the transition to ESM. It's primarily used by tools that process natural language, such as spell-checkers or linting tools, to correctly identify and potentially exclude words that are meant as examples or explicitly quoted text rather than standard vocabulary, rather than actual words to be evaluated.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install nlcst-is-literal"],"cli":null},"imports":["import { isLiteral } from 'nlcst-is-literal'","import {isLiteral} from 'https://esm.sh/nlcst-is-literal@3'","import type { Node } from 'nlcst'; /* ... */ isLiteral(parent: Node, index: number)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { read } from 'to-vfile';\nimport { ParseEnglish } from 'parse-english';\nimport { visit } from 'unist-util-visit';\nimport { toString } from 'nlcst-to-string';\nimport { isLiteral } from 'nlcst-is-literal';\n\nasync function processDocument() {\n  const exampleText = `\n    The word “foo” is meant as a literal.\n    The word «bar» is meant as a literal.\n    The word (baz) is meant as a literal.\n    The word, qux, is meant as a literal.\n    The word — quux — is meant as a literal.\n    This sentence includes a regular word.\n  `;\n\n  // Create a mock vfile for the example text\n  const file = {\n    path: 'example.txt',\n    contents: exampleText,\n    toString() { return this.contents; }\n  };\n\n  const tree = new ParseEnglish().parse(String(file));\n\n  console.log('Literal words identified:');\n  visit(tree, 'WordNode', function (node, index, parent) {\n    if (isLiteral(parent, index)) {\n      console.log(`- ${toString(node)}`);\n    }\n  });\n}\n\nprocessDocument().catch(console.error);\n","lang":"javascript","description":"This quickstart demonstrates how to parse a text, visit its word nodes, and use `isLiteral` to identify and log words that are enclosed by delimiters such as quotes, parentheses, or dashes.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}