@param      $keyword
@param bool $isLastWord

@return int
197402
public function totalMatchingDocuments($keyword, $isLastWord = false)
    {
        $occurance = $this->getWordlistByKeyword($keyword, $isLastWord);
        if (isset($occurance[0])) {
            return $occurance[0]['num_docs'];
        }

        return 0;
    }
1170433
public function keyword($keyword)
    {
        $list = $this->keywordList($keyword);
        if (empty($list)) {
            throw new RuntimeException(sprintf('Keyword "%s" does not exist.', $keyword));
        }

        return $list[0];
    }
538021
private function compareUseStatementsByNamespaceCount(
        UseStatement $prevStatement,
        UseStatement $nextStatement
    ): int {
        $aNameParts = explode(NamespaceHelper::NAMESPACE_SEPARATOR, $prevStatement->getFullyQualifiedTypeName());
        $bNameParts = explode(NamespaceHelper::NAMESPACE_SEPARATOR, $nextStatement->getFullyQualifiedTypeName());

        return count($aNameParts) <=> count($bNameParts);
    }
886924
public function getByKeyword($keyword)
        {
            $results = $this->twitterProvider->get("search/tweets", [
                "q"           => $keyword,
                "result_type" => $this->type,
                "count"       => $this->amount,
            ]);

            return $this->processResults($results);
        }
1372934
public function search($phrase, $numOfResults = 100)
    {
        $startTimer = microtime(true);
        $keywords   = $this->breakIntoTokens($phrase);
        $keywords   = new Collection($keywords);

        $keywords = $keywords->map(function ($keyword) {
            return $this->stemmer->stem($keyword);
        });

        $tfWeight  = 1;
        $dlWeight  = 0.5;
        $docScores = [];
        $count     = $this->totalDocumentsInCollection();

        foreach ($keywords as $index => $term) {
            $isLastKeyword = ($keywords->count() - 1) == $index;
            $df            = $this->totalMatchingDocuments($term, $isLastKeyword);
            $idf           = log($count / max(1, $df));
            foreach ($this->getAllDocumentsForKeyword($term, false, $isLastKeyword) as $document) {
                $docID = $document['doc_id'];
                $tf    = $document['hit_count'];
                $num   = ($tfWeight + 1) * $tf;
                $denom = $tfWeight
                     * ((1 - $dlWeight) + $dlWeight)
                     + $tf;
                $score             = $idf * ($num / $denom);
                $docScores[$docID] = isset($docScores[$docID]) ?
                $docScores[$docID] + $score : $score;
            }
        }

        arsort($docScores);

        $docs = new Collection($docScores);

        $totalHits = $docs->count();
        $docs      = $docs->map(function ($doc, $key) {
            return $key;
        })->take($numOfResults);
        $stopTimer = microtime(true);

        if ($this->isFileSystemIndex()) {
            return $this->filesystemMapIdsToPaths($docs)->toArray();
        }
        return [
            'ids'            => array_keys($docs->toArray()),
            'hits'           => $totalHits,
            'execution_time' => round($stopTimer - $startTimer, 7) * 1000 ." ms"
        ];
    }
463624
public function setKeyword($keyword, $language = null)
    {
        if (empty($language)) {
            $language = $this->mainLanguageCode;
        }

        if (!is_array($this->keywords)) {
            $this->keywords = [];
        }

        $this->keywords[$language] = $keyword;
    }
1151656
public function isKeyword($word)
    {
        if ($this->keywords === null) {
            $this->initializeKeywords();
        }

        return isset($this->keywords[strtoupper($word)]);
    }
107209
public function wiki($keyword)
    {
        if (!empty($keyword)) {
            $ch = curl_init(sprintf($this->_wikiApiUrl, $keyword));
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $result = curl_exec($ch);
            $error = curl_errno($ch);
            curl_close($ch);

            // $xml = simplexml_load_string($result);
            // if ((string)$xml->Section->Item->Description) {
            //     return array(
            //         (string)$xml->Section->Item->Text,
            //         (string)$xml->Section->Item->Description,
            //         (string)$xml->Section->Item->Url
            //     );
            echo $result;
            if ($result)
            {
                $json = json_decode($result);
                if ($json->description) {
                    return array($json->Text, $json->Description, $json->Url);
                }
            }
            else {
               echo $error;
            }
            return false;
        }
        return false;
    }
979081
public function count($substring = null) {
		if ($substring === null) {
			return mb_strlen($this->rawString, $this->charset);
		}
		else {
			return mb_substr_count($this->rawString, $substring, $this->charset);
		}
	}
985549
public function createKeywordIfNotExists($keyword, $do_persist = true)
    {
        if (null === $keyword_object = $this->em->getRepository('BackBee\NestedNode\KeyWord')->exists($keyword)) {
            $keyword_object = new \BackBee\NestedNode\KeyWord();
            $keyword_object->setRoot($this->em->find('BackBee\NestedNode\KeyWord', md5('root')));
            $keyword_object->setKeyWord(preg_replace('#[/\"]#', '', trim($keyword)));

            if (true === $do_persist) {
                $this->em->persist($keyword_object);
                $this->em->flush($keyword_object);
            }
        }

        return $keyword_object;
    }
789222
public function count($terms = null)
    {
        if (!$this->table()) {
            return 0;
        }

        $query = $this->select(['count(*) count']);

        $this->normalizeTerms($query, $terms);

        return (int) $query->execute()->fetch()['count'];
    }
592083
protected function atLeastOneKeyword( $keyword, array $data ) {

		// TODO: Does this work with multi-byte characters?

		foreach ( $data as $key => $val ) {
			if ( is_array( $val ) ) {
				$found = $this->atLeastOneKeyword( $keyword, $val );
				if ( $found ) {
					return true;
				} else {
					continue;
				}
			} elseif ( false !== stripos( $val, $keyword ) ) {
				return true;
			}
		}

		return false;
	}
1334118
public function getFullTagDataByKeywordAndParentId($keyword, $parentId, array $translations = null, $useAlwaysAvailable = true)
    {
        $query = $this->createTagFindQuery($translations, $useAlwaysAvailable);
        $query->where(
            $query->expr->eq(
                $this->handler->quoteColumn('keyword', 'eztags_keyword'),
                $query->bindValue($keyword, null, PDO::PARAM_STR)
            ),
            $query->expr->eq(
                $this->handler->quoteColumn('parent_id', 'eztags'),
                $query->bindValue($parentId, null, PDO::PARAM_INT)
            )
        );

        $statement = $query->prepare();
        $statement->execute();

        return $statement->fetchAll(PDO::FETCH_ASSOC);
    }
358952
public function addKeyword($keyword)
    {
        if (is_array($keyword)):
            $this->keywords = array_merge($keyword, $this->keywords);
        else:
            $this->keywords[] = strip_tags($keyword);
        endif;

        return $this;
    }
1180646
public function exists($keyword)
    {
        $object = null;
        $result = $this->_em->getConnection()->executeQuery(sprintf(
            'SELECT uid FROM keyword WHERE hex(lower(keyword)) = hex(lower("%s"))',
            preg_replace('#[/\"]#', '', trim($keyword))
        ))->fetchAll();

        if (0 < count($result)) {
            $uid = array_shift($result);
            $object = $this->find($uid['uid']);
        }

        return $object;
    }
397787
function getKeywordLength (keyword) {
    const length = keyword.length;
    return {
      length,
      score: calc.iScore(1, MAX_KEYWORD_LENGTH, length)
    };
  }
137809
public function where($table, $column, $keyword)
    {
        $connection = Connection::connect();

        $selectValue = $connection->prepare('select * from '.$table.' where '.$column.' = \''.$keyword.'\'');
        $selectValue->execute();

        return $selectValue->fetch(PDO::FETCH_ASSOC);
    }