private function _countWords(?Node $node): int {
        $result = 0;
        if (null === $node) return $result;
        if ($node->isEndOfWordNode()) $result++;
        for ($i = 0; $i < self::ALPHABET_SIZE; $i++) {
            if ($node->hasChild($i)) {
                $child = $node->getChildNode($i);
                $result += $this->_countWords($child);
            }
        }
        return $result;
    }