Add a word to the dictionary
349259
def add(self, word):
        """"""
        if not word or word.strip() == '':
            return
        self.words[word]=word
1141361
def _add_phrase(cls, phrase, phrase_id, dictionary=None, word_list=None):
        
        # @Note: this function is called recursively
        if dictionary is None:
            dictionary = {}
        if len(phrase):
            current_word = phrase[0]
            # if word_list is not None and current_word not in word_list: #@TODO remove, words should already be ids
            #     word_list.add(current_word)
            if current_word not in dictionary:
                dictionary[current_word] = {}
            cls._add_phrase(phrase[1:], phrase_id, dictionary[current_word], word_list)
        else:
            dictionary[None] = phrase_id
        return dictionary
749557
protected function updateWords()
    {
        try {
            $vocabulary = [];
            $allWords = $this->prepareWords();
            $this->addNewWords($allWords);
            $queryVocabulary = (new Query())->from(Vocabulary::tableName())->where(['word' => $allWords]);
            foreach ($queryVocabulary->each() as $vocabularyNew) {
                $vocabulary[$vocabularyNew['id']] = [$vocabularyNew['id'], $this->id];
            }
            if (!empty($vocabulary)) {
                if (!Podium::getInstance()->db->createCommand()->batchInsert(
                        '{{%podium_vocabulary_junction}}', ['word_id', 'post_id'], array_values($vocabulary)
                    )->execute()) {
                    throw new Exception('Words connections saving error!');
                }
            }
            $queryJunction = (new Query())->from('{{%podium_vocabulary_junction}}')->where(['post_id' => $this->id]);
            foreach ($queryJunction->each() as $junk) {
                if (!array_key_exists($junk['word_id'], $vocabulary)) {
                    if (!Podium::getInstance()->db->createCommand()->delete(
                            '{{%podium_vocabulary_junction}}', ['id' => $junk['id']]
                        )->execute()) {
                        throw new Exception('Words connections deleting error!');
                    }
                }
            }
        } catch (Exception $e) {
            Log::error($e->getMessage(), null, __METHOD__);
            throw $e;
        }
    }
629916
def add_term(set_id, term, access_token):
    
    api_call('post', 'sets/{}/terms'.format(set_id), term.to_dict(), access_token=access_token)
953612
public static void append(String key, String[] words) {

        SmartForest<List<String>> synonyms = get(key);

        Set<String> set = new HashSet<>();

        for (String word : words) {
            if (StringUtil.isBlank(word)) {
                continue;
            }
            set.add(word);
        }

        if (set.size() <= 1) {
            LOG.warn(Arrays.toString(words) + " not have any change because it less than 2 word");
            return;
        }

        set.addAll(findAllWords(key, words));

        List<String> list = new ArrayList<>(set);

        for (String word : list) {
            synonyms.addBranch(word, list);
        }
    }
828989
def add_word(self, word, freq=None, tag=None):
        
        self.check_initialized()
        word = strdecode(word)
        freq = int(freq) if freq is not None else self.suggest_freq(word, False)
        self.FREQ[word] = freq
        self.total += freq
        if tag:
            self.user_word_tag_tab[word] = tag
        for ch in xrange(len(word)):
            wfrag = word[:ch + 1]
            if wfrag not in self.FREQ:
                self.FREQ[wfrag] = 0
        if freq == 0:
            finalseg.add_force_split(word)
1049422
private void updateIgnoredWordDictionary() {
    wordsToBeIgnoredDictionary = wordsToBeIgnored
                                   .stream()
                                   .collect(Collectors.groupingBy(s -> s.substring(0,1), Collectors.toSet()));
    wordsToBeIgnoredDictionaryIgnoreCase = wordsToBeIgnored
                                             .stream()
                                             .map(String::toLowerCase)
                                             .collect(Collectors.groupingBy(s -> s.substring(0,1), Collectors.toSet()));
  }
97077
private void addWord(final String word) {

		final int length = word.length();
		if (length >= wordMinLength && length <= wordMaxLength) {

			words.add(word);

			wordCount++;
		}
	}
305094
def remove(self, word):
        
        self._dictionary.pop(word.lower())
        self._update_dictionary()
1002821
def add_field(self, field_name: str, field: Field, vocab: Vocabulary = None) -> None:
        
        self.fields[field_name] = field
        if self.indexed:
            field.index(vocab)
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
466366
public WordNumberCollectorBundle addWord(String key, String word) {
        wordCollector.add(key, word);
        return this;
    }
167393
def mergewords(self, newword, *originalwords, **kwargs):
        """"""
        return self.correctwords(originalwords, [newword], **kwargs)
1119128
def _add_word(completer):
    
    def inner(word: str):
        completer.words.add(word)
    return inner
100771
private function fillDictionaryWords() {
    foreach($this->dictionary as $w):
      $this->dictionaryWords[] = is_array($w) ? $w[0] : $w;
    endforeach;
  }
499465
public void add(String word) {
		if (word.trim().length() > 0)
			m_Words.add(word.trim().toLowerCase());
	}
112589
protected function updateDictionary()
    {
        // Change some terms
        $this->dictionary = array_replace(
            $this->dictionary,
            [
                'agency_code'   => 'Agência/Cod. Beneficiário',
                'date_process'  => 'Data do processameto',
                'doc_number_sh' => 'Nº do documento',
                'discount'      => '(-) Desconto/ Abatimento',
                'doc_value'     => 'Valor',
                'doc_valueU'    => 'Valor',
                'doc_value='    => '(=) Valor do documento',
                'fine'          => '(+) Mora/Multa',
                'guarantor'     => 'Sacador/Avalista: ',
                'instructions'  => 'Instruções',
                'kind'          => 'Espécie doc',
                'currency'      => 'Moeda',
            ]
        );

        // Make most terms upper case
        $keys = [
            'accept', 'addition', 'agency_code', 'amount', 'assignor',
            'bank_use', 'charged', 'client', 'currency', 'date_document',
            'date_due', 'date_process', 'deduction', 'demonstrative',
            'discount', 'doc_number_sh', 'doc_value', 'doc_value=',
            'doc_valueU', 'fine', 'guarantor', 'instructions', 'kind',
            'mech_auth', 'our_number', 'payment_place', 'wallet',
        ];
        foreach ($keys as $key) {
            $this->dictionary[$key] = mb_strtoupper($this->dictionary[$key]);
        }
    }