{@inheritDoc}

@throws DictionaryNotFoundException When the dictionary does not exist.
437317
public function getDictionary(
        string $name,
        string $sourceLanguage,
        string $targetLanguage,
        array $customData = []
    ): DictionaryInterface {
        $this->logger->debug('Contao: opening dictionary ' . $name);
        if (array_key_exists($name, $this->dictionaryMeta)) {
            $metaData   = $this->dictionaryMeta[$name];
            $dictionary = new ContaoTableDictionary(
                $metaData['table'],
                $sourceLanguage,
                $targetLanguage,
                $this->connection,
                $this->mapBuilder->getMappingFor($metaData['map'], $sourceLanguage, $targetLanguage),
                $this->extractorFactory->getExtractorsForTable($metaData['table'])
            );
            $dictionary->setLogger($this->logger);

            return $dictionary;
        }
        if (static::ALL_TABLES === $name) {
            $dictionary = new CompoundDictionary($sourceLanguage, $targetLanguage);
            foreach (array_keys($this->dictionaryMeta) as $subName) {
                $dictionary->addDictionary($subName, $this->getDictionary(
                    $subName,
                    $sourceLanguage,
                    $targetLanguage,
                    $customData
                ));
            }
            return $dictionary;
        }

        throw new DictionaryNotFoundException($name, $sourceLanguage, $targetLanguage);
    }
335038
def _add_to_dict(t, container, name, value):
    

    if name in container:
        raise Exception("%s '%s' already exists" % (t, name))
    else:
        container[name] = value
958162
function interpretDict(dict, meta, strings) {
            var newDict = {};

            // Because we also want to include missing values, we start out from the meta list
            // and lookup values in the dict.
            for (var i = 0, l = meta.length; i < l; i++) {
                var m = meta[i];
                var value = dict[m.op];
                if (value === undefined) {
                    value = m.value !== undefined ? m.value : null;
                }

                if (m.type === 'SID') {
                    value = getCFFString(strings, value);
                }

                newDict[m.name] = value;
            }

            return newDict;
        }
158284
@Override
    public Dictionary getDictionary(@NonNull String key) {
        if (key == null) { throw new IllegalArgumentException("key cannot be null."); }

        synchronized (lock) {
            final Object obj = getMValue(internalDict, key).asNative(internalDict);
            return obj instanceof Dictionary ? (Dictionary) obj : null;
        }
    }
796603
private function loadDictionaries()
    {
        if (null !== $this->words) {
            // Dictionaries already loaded
            return;
        }

        $this->words = array();

        $dictionaryFiles = glob($this->dictionaryDir . '/*');

        foreach ($dictionaryFiles as $dictionaryFile) {
            $fileName = substr($dictionaryFile, strlen($this->dictionaryDir) + 1);

            preg_match('/^(.+)\./', $fileName, $parts);
            $lang = $parts[1];

            $words = include $dictionaryFile;

            foreach ($words as $word) {
                if (!isset($this->words[$word])) {
                    $this->words[$word] = array();
                }

                if (!in_array($lang, $this->words[$word])) {
                    $this->words[$word][] = $lang;
                }
            }
        }
    }
1330289
@Beta
    public static <K, V> Map<K, V> fromDictionary(Dictionary<K, V> dictionary) {
        checkArgument(dictionary != null, "Expected non-null dictionary");

        ImmutableMap.Builder<K, V> builder = ImmutableMap.builder();

        for (Enumeration<K> keys = dictionary.keys(); keys.hasMoreElements(); ) {
            K key = keys.nextElement();
            V value = dictionary.get(key);
            builder.put(key, value);
        }

        return builder.build();
    }
197075
function DynamicDictionaries(trie, token_info_dictionary, connection_costs, unknown_dictionary) {
    if (trie != null) {
        this.trie = trie;
    } else {
        this.trie = doublearray.builder(0).build([
            {k: "", v: 1}
        ]);
    }
    if (token_info_dictionary != null) {
        this.token_info_dictionary = token_info_dictionary;
    } else {
        this.token_info_dictionary = new TokenInfoDictionary();
    }
    if (connection_costs != null) {
        this.connection_costs = connection_costs;
    } else {
        // backward_size * backward_size
        this.connection_costs = new ConnectionCosts(0, 0);
    }
    if (unknown_dictionary != null) {
        this.unknown_dictionary = unknown_dictionary;
    } else {
        this.unknown_dictionary = new UnknownDictionary();
    }
}
501155
public T lookup(String name) throws NamingException {
        T binding = super.get(name);
        if (binding != null) {
            return binding;
        }

        // Binding does not exist.  Check if any the contexts are bindings.
        String contextName = name;
        while (!(contextName = getContextName(contextName)).isEmpty()) {
            if (containsKey(contextName)) {
                throw new NotContextException(namespace + "/" + contextName);
            }
        }

        return null;
    }
708460
def add_dict(self, dyn_dict):
        ''
        if not isinstance(dyn_dict, dict):
            raise Exception('DynStruct.add_dict expects a dictionary.' +
                            'Recieved: ' + six.text_type(type(dyn_dict)))
        for (key, val) in six.iteritems(dyn_dict):
            self[key] = val
567800
def update(self, dictionary):
        """"""
        allowed_attrs = list(self.__attributes__.keys())
        allowed_attrs += [a.alias for a in self.__attributes__.values()]
        for k in dictionary:
            # We only update existing attributes
            if k in allowed_attrs:
                setattr(self, k, dictionary[k])
        return self
927378
public void addCustomDictionary(String name, List values) throws JSONException {
		logger.debug("Adding custom Dictionary [" + name + "] = (list)");
		put(name, values, payload, false);
	}
732261
private function update_dict()
    {
        if (strcasecmp($this->options['dictionary'], 'shared') != 0) {
            $userid = $this->rc->get_user_id();
        }

        $plugin = $this->rc->plugins->exec_hook('spell_dictionary_save', array(
            'userid' => $userid, 'language' => $this->lang, 'dictionary' => $this->dict));

        if (!empty($plugin['abort'])) {
            return;
        }

        if ($this->have_dict) {
            if (!empty($this->dict)) {
                $this->rc->db->query(
                    "UPDATE " . $this->rc->db->table_name('dictionary', true)
                    ." SET `data` = ?"
                    ." WHERE `user_id` " . ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                        ." AND `language` = ?",
                    implode(' ', $plugin['dictionary']), $plugin['language']);
            }
            // don't store empty dict
            else {
                $this->rc->db->query(
                    "DELETE FROM " . $this->rc->db->table_name('dictionary', true)
                    ." WHERE `user_id` " . ($plugin['userid'] ? "= ".$this->rc->db->quote($plugin['userid']) : "IS NULL")
                        ." AND `language` = ?",
                    $plugin['language']);
            }
        }
        else if (!empty($this->dict)) {
            $this->rc->db->query(
                "INSERT INTO " . $this->rc->db->table_name('dictionary', true)
                ." (`user_id`, `language`, `data`) VALUES (?, ?, ?)",
                $plugin['userid'], $plugin['language'], implode(' ', $plugin['dictionary']));
        }
    }
277005
public void setDictionary(THashSet<String> newset) {
		if(newset.size()==0)
			return;
		ArrayList<String> al = new ArrayList<String>();
		MyCollection.TSet2List(newset, al);
		Dictionary dict = new Dictionary();
		dict.addSegDict(al);
		setDictionary(dict);

	}
647353
public void addCustomDictionary(String name, String value) throws JSONException {
		logger.debug("Adding custom Dictionary [" + name + "] = [" + value + "]");
		put(name, value, payload, false);
	}
1303013
private void loadDictionaries(final String inputDir) throws IOException {
    final List<File> fileList = StringUtils.getFilesInDir(new File(inputDir));
    dictNames = new ArrayList<String>(fileList.size());
    dictionaries = new ArrayList<Map<String, String>>(fileList.size());
    dictionariesIgnoreCase = new ArrayList<Map<String, String>>(
        fileList.size());
    System.err.println("\tloading dictionaries in " + inputDir + " directory");
    for (int i = 0; i < fileList.size(); ++i) {
      if (DEBUG) {
        System.err.println(
            "\tloading dictionary:...." + fileList.get(i).getCanonicalPath());
      }
      dictNames.add(fileList.get(i).getCanonicalPath());
      dictionaries.add(new HashMap<String, String>());
      dictionariesIgnoreCase.add(new HashMap<String, String>());

      final List<String> fileLines = Files.readLines(fileList.get(i),
          Charsets.UTF_8);
      for (final String line : fileLines) {
        final String[] lineArray = tabPattern.split(line);
        if (lineArray.length == 2) {
          dictionaries.get(i).put(lineArray[0], lineArray[1]);
          if (!line.equalsIgnoreCase("in") && !line.equalsIgnoreCase("on")
              && !line.equalsIgnoreCase("us") && !line.equalsIgnoreCase("or")
              && !line.equalsIgnoreCase("am")) {
            dictionariesIgnoreCase.get(i).put(lineArray[0].toLowerCase(),
                lineArray[1]);
          }
        }
      }
    }
    System.err.println("found " + dictionaries.size() + " dictionaries");
  }
1277709
static void fixReservedIdentifiers(Map<?, String> methodToIdentifier) {
    for (Map.Entry<?, String> entry : methodToIdentifier.entrySet()) {
      if (SourceVersion.isKeyword(entry.getValue())) {
        entry.setValue(disambiguate(entry.getValue(), methodToIdentifier.values()));
      }
    }
  }
49100
def get_dict(dictionary, *keys,**kwargs):
    

    if 'default' in kwargs:
        default = kwargs['default']
    else:
        default = None

    existing = dictionary
    for i in range(0, len(keys)):

        if keys[i] in existing:

            existing = existing[keys[i]]
        else:

            return default
    return existing