Attach headword.
@param string|Headword $headword
@return \static
762982
public function headword($headword)
    {
        if ($headword instanceof Headword) {
            return $this->andWhere(['headword_guid' => $headword->guid]);
        }
        if (is_string($headword)) {
            $headword = Headword::find()->where(['word' => $headword])->one();
            if (!$headword) {
                return $this;
            }
            return $this->andWhere(['headword_guid' => $headword->guid]);
        }
    }
498676
public function startsWith($word, $identical = false)
    {
        $this->addCondition(__METHOD__, [$word, $identical]);

        return $this;
    }
492488
public function addHeader(string $header, $value): self
    {
        $this->header->set($header, $value, false);

        return $this;
    }
615164
public function setHead(array $head)
    {
        $this->head = $head;
        curl_setopt($this->curlHandler, CURLOPT_HTTPHEADER, $this->head);
        return $this;
    }
811088
public function addCustomHeader($header)
    {
        self::$headers[self::CUSTOM_HEADERS][] = $this->normalizeHeaderName($header);
        return $this;
    }
1151656
public function isKeyword($word)
    {
        if ($this->keywords === null) {
            $this->initializeKeywords();
        }

        return isset($this->keywords[strtoupper($word)]);
    }
519050
public function attachPermission(...$permissions)
    {
        $this->eachPermission($permissions, function($permission) {
            if (! $this->hasDirectPermission($permission)) {
                $this->permissions()->attach($permission->id);
            }
        });

        return $this;
    }
281722
public function setHeader($header)
    {
        $header = trim($header);
        $header = language($header);
        $this->store('header', $header);
        presenter()->meta->title->append($header);

        return $this;
    }
1080748
protected function getHead()
    {
        $head = $this->getDocument()->createElement('head');
        $metahttp = $this->getDocument()->createElement('meta');
        $metahttp->setAttribute('http-equiv', 'Content-Type');
        $metahttp->setAttribute('content', 'text/html; charset=utf-8');
        $head->appendChild($metahttp);
        $head->appendChild($this->getDocument()->createElement('title', 'Generated List'));

        foreach ($this->getStylesheets() as $href) {
            $stylesheet = $this->getDocument()->createElement('link');
            $stylesheet->setAttribute('href', $href);
            $stylesheet->setAttribute('rel', 'stylesheet');
            $stylesheet->setAttribute('type', 'text/css');
            $head->appendChild($stylesheet);
        }

        return $head;
    }
885597
public function addStopWords($stopWords)
    {
        $this->initializeStopWordsUrl();
        $json = $this->stopWordParser->toJson($stopWords);
        return $this->_sendRawPost($this->_stopWordsUrl, $json, 'application/json');
    }
820909
public function withKeywords(array $keywords)
    {
        Assertion::allString($keywords);
        Assertion::allNotBlank($keywords);

        $instance = clone $this;

        $instance->keywords = $keywords;

        return $instance;
    }
375419
public function addHeader(string $header, string $value): self
    {
        $this->headers[$header] = $value;

        return $this;
    }
166143
public function head($options = null) {
		if ($options !== null) {
			$this->setOptions($options, false, false);
		}
		
		return $this;
	}
969752
public function setInputWords($words = null)
    {
        if ($words === null) {
            $this->inputWords = new WordCollection();
        } else {
            $this->inputWords = $words;
        }

        return $this;
    }
177589
public function addKeyword(Keyword $keyword)
    {
        if (!$this->keywords->contains($keyword)) {
            $this->keywords->add($keyword);
        }
    }
332890
public function addHeader($header)
    {
        if (is_string($header)) {
            $header = HeaderField::fromString($header);
        }
        $this->headers[] = $header;
        return $this;
    }
252293
public function add(string $word): self {
        // 构建临时树
        $tmp_tree = &$this->tmp_tree;
        foreach ($this->split($word) as $char) {
            // 加入索引
            $code = $this->index($char);

            // 插树
            $tmp_tree = &$this->putNode($code, $tmp_tree);

            // 抛弃无用词条
            if ($tmp_tree == $this->tmp_tree) {
                break;
            }
        }

        // 修剪trie树，抛弃无用词条
        $tmp_tree && $tmp_tree != $this->tmp_tree && $tmp_tree = [];

        return $this;
    }