isFile()) { continue; } $ngrams = array(); foreach(file($file->getPathname(), FILE_IGNORE_NEW_LINES|FILE_SKIP_EMPTY_LINES) as $line) { list($word, $score) = explode("\t", $line, 2); $ngrams[$word] = intval($score); } $cat->writeLanguageFile($ngrams, $argv[2] . "/" . $file->getBasename()); } exit(0);