{"componentChunkName":"component---node-modules-carrotsearch-gatsby-theme-apidocs-templates-documentation-page-js","path":"/rest-api-dictionaries/","result":{"data":{"html":{"frontmatter":{"id":"rest-api-dictionaries","title":"Dictionaries"},"html":"<article>\n  <h1>Dictionaries</h1>\n\n  <p id=\"42063fa9\">\n    Lingo3G uses dictionaries to improve the quality of clustering for a\n    specific language. This article shows how to customize dictionaries in the\n    REST API.\n  </p>\n\n  <section id=\"customizing-global-dictionaries\">\n    <h2>\n        <a class=\"anchor\" href=\"#customizing-global-dictionaries\" 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>Customizing global dictionaries\n      </h2>\n\n    <p id=\"customizing-global-dictionaries:d6ad32ca\">\n      To customize the\n      <a href=\"/dictionaries/#scopes-of-dictionaries:global\">global</a>\n      <a href=\"/dictionaries/\">dictionaries</a> for REST API clustering, go\n      to the\n      <a href=\"/dictionaries/#location-of-dictionary-files:document-clustering-server\">DCS dictionaries folder</a>\n      and edit the files as required. Once you finish editing, restart the DCS\n      for the changes to take effect.\n    </p>\n  </section>\n\n  <section id=\"per-request-dictionaries\">\n    <h2>\n        <a class=\"anchor\" href=\"#per-request-dictionaries\" 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>Using per-request dictionaries\n      </h2>\n\n    <p id=\"per-request-dictionaries:cd7df334\">\n      You can provide extra\n      <a href=\"/dictionaries/#scopes-of-dictionaries:per-request\"><em>per-request</em></a>\n      dictionary entries for a specific clustering request. Lingo3G applies\n      these extra entries as an addition to the default dictionaries. For\n      example, if the end-user wants to remove specific labels from the\n      clustering result they are currently viewing, your software can add such\n      labels to the per-request label dictionary and rerun the clustering.\n    </p>\n\n    <p id=\"per-request-dictionaries:f2e9a74d\">\n      The <a href=\"/lingo3g-parameters/#dictionaries\">dictionaries</a>\n      section of the Lingo3G parameters object groups all per-request\n      dictionaries. You can use any combination of per-request\n      <a href=\"/lingo3g-parameters/#dictionaries.labels\">label</a>,\n      <a href=\"/lingo3g-parameters/#dictionaries.synonyms\">synonym</a> and\n      <a href=\"/lingo3g-parameters/#dictionaries.tags\">tag</a> dictionaries.\n    </p>\n\n    <section id=\"per-request-dictionaries:label-dictionaries\">\n      <h3>\n        <a class=\"anchor\" href=\"#per-request-dictionaries:label-dictionaries\" 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>Label dictionaries\n      </h3>\n\n      <p id=\"per-request-dictionaries:label-dictionaries:7f478d9c\">\n        To add per-request entries to the\n        <a href=\"/label-dictionary/\">label dictionary</a>, use the\n        <a href=\"/lingo3g-parameters/#dictionaries.labels\"><code>dictionaries.labels</code></a>\n        parameter.\n      </p>\n\n      <p id=\"per-request-dictionaries:label-dictionaries:c33dd8f6\">\n        In the following example, without the per-request label dictionary,\n        Lingo3G creates a cluster called\n        <em>Configuration Issue on Windows</em>. Adding two entries to the\n        per-request dictionary replaces the label with <em>Windows</em>:\n      </p>\n\n      <figure id=\"per-request-dictionaries:label-dictionaries:example-request\">\n        <div class=\"gatsby-highlight\">\n    <pre class=\"language-json\"><code data-language=\"json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"language\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"English\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"algorithm\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Lingo3G\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"parameters\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"clusters\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token property\">\"maxClusterSize\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.8</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n<span class=\"gatsby-highlight-code-line\">    <span class=\"token property\">\"dictionaries\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n</span><span class=\"gatsby-highlight-code-line\">      <span class=\"token property\">\"labels\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n</span><span class=\"gatsby-highlight-code-line\">        <span class=\"token punctuation\">{</span>\n</span><span class=\"gatsby-highlight-code-line\">          <span class=\"token property\">\"glob\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n</span><span class=\"gatsby-highlight-code-line\">            <span class=\"token string\">\"* issue *\"</span><span class=\"token punctuation\">,</span>\n</span><span class=\"gatsby-highlight-code-line\">            <span class=\"token string\">\"configuration\"</span>\n</span><span class=\"gatsby-highlight-code-line\">          <span class=\"token punctuation\">]</span>\n</span><span class=\"gatsby-highlight-code-line\">        <span class=\"token punctuation\">}</span>\n</span><span class=\"gatsby-highlight-code-line\">      <span class=\"token punctuation\">]</span>\n</span><span class=\"gatsby-highlight-code-line\">    <span class=\"token punctuation\">}</span>\n</span>  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"documents\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"PDF Viewer configuration issue on Windows\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Firefox plugin configuration issue on Windows\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"CPU usage for flash in Firefox\"</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>\n            Example <code>/cluster</code> request with per-request label\n            dictionary entries.\n          </p>\n        </figcaption>\n      </figure>\n    </section>\n\n    <section id=\"per-request-dictionaries:synonym-dictionaries\">\n      <h3>\n        <a class=\"anchor\" href=\"#per-request-dictionaries:synonym-dictionaries\" 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>Synonym dictionaries\n      </h3>\n\n      <p id=\"per-request-dictionaries:synonym-dictionaries:c39c99a3\">\n        To add per-request entries to the\n        <a href=\"/synonym-dictionary/\">synonym dictionary</a>, use the\n        <a href=\"/lingo3g-parameters/#dictionaries.synonyms\"><code>dictionaries.synonyms</code></a>\n        parameter.\n      </p>\n\n      <p id=\"per-request-dictionaries:synonym-dictionaries:dbf412e0\">\n        In the following example, adding <em>Chrome</em> and <em>Firefox</em>\n        as synonyms puts documents containing either of these words in the same\n        cluster.\n      </p>\n\n      <figure id=\"per-request-dictionaries:synonym-dictionaries:example-request\">\n        <div class=\"gatsby-highlight\">\n    <pre class=\"language-json\"><code data-language=\"json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"language\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"English\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"algorithm\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Lingo3G\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"parameters\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"clusters\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token property\">\"maxClusterSize\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.8</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"allowOneDocumentClusters\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n<span class=\"gatsby-highlight-code-line\">    <span class=\"token property\">\"dictionaries\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n</span><span class=\"gatsby-highlight-code-line\">      <span class=\"token property\">\"tags\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n</span><span class=\"gatsby-highlight-code-line\">        <span class=\"token punctuation\">{</span>\n</span><span class=\"gatsby-highlight-code-line\">          <span class=\"token property\">\"tag\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"name\"</span><span class=\"token punctuation\">,</span>\n</span><span class=\"gatsby-highlight-code-line\">          <span class=\"token property\">\"words\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n</span><span class=\"gatsby-highlight-code-line\">            <span class=\"token string\">\"chrome\"</span><span class=\"token punctuation\">,</span>\n</span><span class=\"gatsby-highlight-code-line\">            <span class=\"token string\">\"firefox\"</span>\n</span><span class=\"gatsby-highlight-code-line\">          <span class=\"token punctuation\">]</span>\n</span><span class=\"gatsby-highlight-code-line\">        <span class=\"token punctuation\">}</span>\n</span><span class=\"gatsby-highlight-code-line\">      <span class=\"token punctuation\">]</span>\n</span>    <span class=\"token punctuation\">}</span>\n  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"documents\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"PDF Viewer configuration on Chrome Windows\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Chrome plugin configuration issue on Windows\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"CPU usage for flash in Firefox\"</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>\n            Example <code>/cluster</code> request with per-request synonym\n            dictionary entries.\n          </p>\n        </figcaption>\n      </figure>\n\n      <p id=\"per-request-dictionaries:synonym-dictionaries:b92342d7\">\n        Note that setting the<a href=\"/lingo3g-parameters/#clusters.allowOneDocumentClusters\"><code>clusters.allowOneDocumentClusters</code></a>\n        to <code>true</code> is required due to the small number of documents in\n        the example. The parameter causes Lingo3G to preserve during processing\n        words with one occurrence, such as <em>Firefox</em> and\n        <em>Chrome</em> in the example. If the example left\n        <code>allowOneDocumentClusters</code>\n        at its default value of <code>false</code>, documents containing\n        <em>Chrome</em> an <em>Firefox</em>\n        would not end up in the same cluster because Lingo3G would filter out\n        the one-occurrence words before applying synonyms.\n      </p>\n    </section>\n\n    <section id=\"per-request-dictionaries:tag-dictionaries\">\n      <h3>\n        <a class=\"anchor\" href=\"#per-request-dictionaries:tag-dictionaries\" 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>Tag dictionaries\n      </h3>\n\n      <p id=\"per-request-dictionaries:tag-dictionaries:2815c4e1\">\n        To add per-request entries to the\n        <a href=\"/tag-dictionary/\">word tag dictionary</a>, use the\n        <a href=\"/lingo3g-parameters/#dictionaries.tags\"><code>dictionaries.tags</code></a>\n        parameter.\n      </p>\n\n      <p id=\"per-request-dictionaries:tag-dictionaries:6ac2c81b\">\n        In the following example, adding <em>Chrome</em> and <em>Firefox</em> to\n        the tags dictionary with the <code>name</code> tag slightly promotes the\n        two words in cluster labels. As a result, Lingo3G chooses\n        <em>Chrome</em> and <em>Firefox</em> over some other words to label the\n        clusters.\n      </p>\n\n      <figure id=\"per-request-dictionaries:tag-dictionaries:example-request\">\n        <div class=\"gatsby-highlight\">\n    <pre class=\"language-json\"><code data-language=\"json\"><span class=\"token punctuation\">{</span>\n  <span class=\"token property\">\"language\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"English\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"algorithm\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Lingo3G\"</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"parameters\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n    <span class=\"token property\">\"clusters\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n      <span class=\"token property\">\"maxClusterSize\"</span><span class=\"token operator\">:</span> <span class=\"token number\">0.8</span><span class=\"token punctuation\">,</span>\n      <span class=\"token property\">\"allowOneDocumentClusters\"</span><span class=\"token operator\">:</span> <span class=\"token boolean\">true</span>\n    <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n<span class=\"gatsby-highlight-code-line\">    <span class=\"token property\">\"dictionaries\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">{</span>\n</span><span class=\"gatsby-highlight-code-line\">      <span class=\"token property\">\"tags\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n</span><span class=\"gatsby-highlight-code-line\">        <span class=\"token punctuation\">{</span>\n</span><span class=\"gatsby-highlight-code-line\">          <span class=\"token property\">\"glob\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n</span><span class=\"gatsby-highlight-code-line\">            <span class=\"token string\">\"Chrome\"</span><span class=\"token punctuation\">,</span> <span class=\"token string\">\"Firefox\"</span>\n</span><span class=\"gatsby-highlight-code-line\">          <span class=\"token punctuation\">]</span>\n</span><span class=\"gatsby-highlight-code-line\">        <span class=\"token punctuation\">}</span>\n</span><span class=\"gatsby-highlight-code-line\">      <span class=\"token punctuation\">]</span>\n</span><span class=\"gatsby-highlight-code-line\">    <span class=\"token punctuation\">}</span>\n</span>  <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n  <span class=\"token property\">\"documents\"</span><span class=\"token operator\">:</span> <span class=\"token punctuation\">[</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"PDF Viewer configuration on Windows\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"Chrome plugin configuration issue on Windows\"</span> <span class=\"token punctuation\">}</span><span class=\"token punctuation\">,</span>\n    <span class=\"token punctuation\">{</span> <span class=\"token property\">\"title\"</span><span class=\"token operator\">:</span> <span class=\"token string\">\"CPU usage for flash in Firefox\"</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>\n            Example <code>/cluster</code> request with per-request tag\n            dictionary entries.\n          </p>\n        </figcaption>\n      </figure>\n    </section>\n  </section>\n</article>","tableOfContents":[{"heading":"Customizing global dictionaries","anchor":"customizing-global-dictionaries"},{"heading":"Using per-request dictionaries","anchor":"per-request-dictionaries","sections":[{"heading":"Label dictionaries","anchor":"per-request-dictionaries:label-dictionaries"},{"heading":"Synonym dictionaries","anchor":"per-request-dictionaries:synonym-dictionaries"},{"heading":"Tag dictionaries","anchor":"per-request-dictionaries:tag-dictionaries"}]}]}},"pageContext":{"slug":"/rest-api-dictionaries/"}},"staticQueryHashes":["1164750013"]}