{"componentChunkName":"component---node-modules-carrotsearch-gatsby-theme-apidocs-templates-documentation-page-js","path":"/tag-dictionary/","result":{"data":{"html":{"frontmatter":{"id":"tag-dictionary","title":"Tag dictionaries"},"html":"<article>\n  <h1>Tag dictionaries</h1>\n\n  <p id=\"65b01f7e\">\n    Tag dictionaries categorize individual words based on their grammatical or\n    semantic function, such as preposition, verb or proper name. You can\n    reference the categories in the\n    <a href=\"/label-dictionary/\">label dictionary</a> to, for example, remove\n    labels ending in a preposition, such as <em>information about</em>.\n  </p>\n\n  <section id=\"built-in\">\n    <h2>\n        <a class=\"anchor\" href=\"#built-in\" aria-hidden=\"true\"><svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"/></svg></a>Built-in tag dictionaries\n      </h2>\n\n    <p id=\"built-in:0275875f\">\n      Lingo3G comes with built-in tag dictionaries for several languages. These\n      dictionaries are precompiled into space- and lookup-efficient data\n      structures, so you cannot modify them. However, you can use the\n      <a href=\"#custom\">custom tag dictionary</a> to override the built-in\n      category for specific words.\n    </p>\n\n    <p id=\"built-in:85dfd96d\">\n      To turn off the built-in tag dictionaries, set the\n      <a href=\"/lingo3g-parameters/#documents.useBuiltInWordDatabaseForLabelFiltering\">\n        <code>useBuiltInWordDatabaseForLabelFiltering</code></a>\n      parameter to <code>false</code>.\n    </p>\n  </section>\n\n  <section id=\"custom\">\n    <h2>\n        <a class=\"anchor\" href=\"#custom\" aria-hidden=\"true\"><svg aria-hidden=\"true\" height=\"16\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"/></svg></a>Custom tag dictionaries\n      </h2>\n\n    <p id=\"custom:a592e8b2\">\n      Lingo3G\n      <a href=\"/dictionaries/#location-of-dictionary-files\">reads</a> the tag\n      dictionary from a JSON file named\n      <code><em>language</em>.tags.json</code>, where <em>language</em> is the\n      language name. The tag dictionary must be an array of objects with the\n      following structure:\n    </p>\n\n    <figure id=\"tag-dictionary:structure\">\n      <div class=\"gatsby-highlight\">\n    <pre class=\"language-json\"><code data-language=\"json\"><span class=\"token punctuation\">[</span>\n  <span class=\"token comment\">// zero or more includes.</span>\n  <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"include\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"relative-path-to-include.json\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"required\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n\n  <span class=\"token comment\">// one or more tags, with word entries.</span>\n  <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"comment\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Optional comment.\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"tag\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"[tag]\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"words\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n      <span class=\"token string\">\"word1\"</span><span class=\"token punctuation\">,</span>\n      <span class=\"token string\">\"word2\"</span>\n    <span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">]</span></code></pre>\n  </div>\n\n      <figcaption>\n        <p>The structure of a Lingo3G tag dictionary.</p>\n      </figcaption>\n    </figure>\n\n    <p id=\"custom:57b29be2\">Each object in the array must be of one of the following types:</p>\n\n    <dl>\n      <dt>include</dt>\n      <dd>\n        <p id=\"custom:a69b9b9e\">\n          Includes all entries from another tag dictionary into this dictionary.\n          You can use includes to split a large tag dictionary into smaller ones\n          or extract a common part of a set of tag dictionaries.\n        </p>\n\n        <div class=\"gatsby-highlight\">\n    <pre class=\"language-json\"><code data-language=\"json\"><span class=\"token punctuation\">{</span> <span class=\"token property\">\"include\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"name.json\"</span><span class=\"token punctuation\">,</span> <span class=\"token property\">\"required\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span> <span class=\"token punctuation\">}</span></code></pre>\n  </div>\n\n        <dl class=\"narrow\">\n          <dt id=\"tag-dictionary:include\" class=\"api\">include</dt>\n          <dd>\n            <p id=\"custom:25928b1d\">\n              (required) Path to the tag dictionary to include, relative to the\n              location of this dictionary.\n            </p>\n          </dd>\n\n          <dt id=\"tag-dictionary:required\" class=\"api\">required</dt>\n          <dd>\n            <p id=\"custom:b568e934\">\n              If <code>true</code> and the file to include does not exist,\n              Lingo3G will trigger an error.\n            </p>\n\n            <p id=\"custom:51d71a11\">\n              If <code>false</code>, Lingo3G will ignore a non-existing include\n              file.\n            </p>\n          </dd>\n        </dl>\n      </dd>\n\n      <dt>word category set</dt>\n      <dd>\n        <p id=\"custom:1ed568dd\">Assigns a category tag to a set of words:</p>\n\n        <div class=\"gatsby-highlight\">\n    <pre class=\"language-json\"><code data-language=\"json\"><span class=\"token punctuation\">{</span> <span class=\"token property\">\"tag\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"...\"</span><span class=\"token punctuation\">,</span> <span class=\"token property\">\"words\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span> <span class=\"token string\">\"a\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"b\"</span><span class=\"token punctuation\">,</span> ... <span class=\"token punctuation\">]</span> <span class=\"token punctuation\">}</span></code></pre>\n  </div>\n\n        <dl class=\"narrow\">\n          <dt id=\"tag-dictionary:tag\" class=\"api\">tag</dt>\n          <dd>\n            <p id=\"custom:b1042ecf\">\n              The category tag or tags to assign for the words listed in the\n              <code>words</code> array.\n            </p>\n\n            <p id=\"custom:fabcbf1c\">\n              Use one or more comma-separated categories from the following\n              list:\n            </p>\n\n            <ul>\n              <li id=\"custom:1620cbd6\">\n                <code>fnc</code>: function word (<em>about</em>, <em>have</em>)\n              </li>\n              <li id=\"custom:1aa81518\"><code>verb</code>: verb (<em>have</em>, <em>allows</em>)</li>\n              <li id=\"custom:a61e2776\"><code>noun</code>: noun (<em>website</em>, <em>test</em>)</li>\n              <li id=\"custom:9550cfa7\"><code>adj</code>: adjective (<em>cool</em>)</li>\n              <li id=\"custom:c55fcfeb\"><code>adv</code>: adverb (<em>fully</em>)</li>\n              <li id=\"custom:41305565\">\n                <code>geo</code>: geographical reference (<em>London</em>)\n              </li>\n              <li id=\"custom:fbf18772\"><code>name</code>: proper noun (<em>John</em>)</li>\n              <li id=\"custom:579673c3\">\n                <code>numeric</code>: numeric values (<em>10.4</em>,\n                <em>2021</em>, <em>14:30</em>, <em>3/4</em>)\n              </li>\n              <li id=\"custom:b88473bc\">\n                <code>sep</code>: phrase separator, such as <em>e.g.</em> or\n                <em>ie</em>. Lingo3G removes phrase separators from processing\n                and therefore will not allow them to appear in cluster labels at\n                all.\n              </li>\n            </ul>\n          </dd>\n\n          <dt id=\"tag-dictionary:words\" class=\"api\">words</dt>\n          <dd>\n            <p id=\"custom:dac1f551\">The list of words to which to apply the <code>tag</code>.</p>\n\n            <p id=\"custom:bce35ae7\">\n              Lingo3G matches the words against the input text in a\n              case-insensitive way and does not apply any further processing,\n              such as grammatical form normalization. Therefore, include all\n              alternative grammatical and spelling variants of a word if\n              necessary, for example: <em>naïve</em>, <em>naive</em>,\n              <em>naïvely</em>, <em>naively</em>.\n            </p>\n          </dd>\n        </dl>\n      </dd>\n    </dl>\n\n    <p id=\"custom:913f6a0d\">A real-world dictionary can look like this:</p>\n\n    <figure id=\"tag-dictionary:example\">\n      <div class=\"gatsby-highlight\">\n    <pre class=\"language-json\"><code data-language=\"json\"><span class=\"token punctuation\">[</span>\n  <span class=\"token punctuation\">{</span> <span class=\"token property\">\"include\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"legal-words.json\"</span><span class=\"token punctuation\">,</span> <span class=\"token property\">\"required\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"tag\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"fnc\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"words\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span> <span class=\"token string\">\"a\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"about\"</span> <span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"tag\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"fnc,verb\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"words\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span> <span class=\"token string\">\"have\"</span> <span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"tag\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"verb\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"words\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span> <span class=\"token string\">\"go\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"allow\"</span> <span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"tag\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"numeric\"</span><span class=\"token punctuation\">,</span>\n    <span class=\"token property\">\"words\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span> <span class=\"token string\">\"thousand\"</span> <span class=\"token punctuation\">]</span>\n  <span class=\"token punctuation\">}</span>\n<span class=\"token punctuation\">]</span></code></pre>\n  </div>\n\n      <figcaption>\n        <p>Tag dictionary example.</p>\n      </figcaption>\n    </figure>\n\n    <div class=\"warning\" id=\"custom:c4ab9a83\">\n      <strong>Tip: how Lingo3G uses word categories by default.</strong>\n\n      <p id=\"custom:277c734a\">\n        The default label dictionary uses the part of speech information in the\n        following way:\n      </p>\n\n      <ul>\n        <li id=\"custom:d1c47856\">\n          removes labels being, starting or ending in a function word or verb\n        </li>\n        <li id=\"custom:79370de8\">removes labels being or ending in an adjective or adverb</li>\n        <li id=\"custom:921dd8f6\">removes labels being or beginning in a number</li>\n        <li id=\"custom:354e7d7a\">\n          slightly boosts labels containing proper nouns or geographic terms\n        </li>\n      </ul>\n\n      <p id=\"custom:727526a6\">\n        You can customize this default behavior by editing the\n        <code>common-rules.labels.json</code> dictionary.\n      </p>\n    </div>\n  </section>\n</article>","tableOfContents":[{"heading":"Built-in tag dictionaries","anchor":"built-in"},{"heading":"Custom tag dictionaries","anchor":"custom"}]}},"pageContext":{"slug":"/tag-dictionary/"}},"staticQueryHashes":["1164750013"]}