Loading TOC...

spell.makeDictionary

spell.makeDictionary(
   $words as String[],
   [$output-kind as String]
) as element(spell:dictionary) | Object

Summary

Creates a dictionary node from a sequence of words.

Parameters
$words The words from which to construct a dictionary.
$output-kind The kind of the returned dictionary node. If "element", an xml element is returned; if "object", a javascript object is returned.

The default value is "object".

Example

  var spell = require("/MarkLogic/spell");

  var words = ["words", "to", "go", "in", "the", "dictionary"];
  spell.makeDictionary(words)

  => 
  {
    "words":[
      "words",
      "to",
      "go",
      "in",
      "the",
      "dictionary"
    ]
  }
  

Example

  var spell = require("/MarkLogic/spell");

  spell.makeDictionary(cts.words())

  => A javascript object containing all the words in the database.  
     Use spell.insert to insert this into the database as a dictionary.  
     This example requires a word lexicon on the database.  You can 
     construct the sequence of words any way you like.
  

Comments

    Powered by MarkLogic Server 7.0-4.1 and rundmc | Terms of Use | Privacy Policy