Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 1.59 KB

README.md

File metadata and controls

28 lines (22 loc) · 1.59 KB

Babelfish Latest Stable Version Build Status Type Coverage

Babelfish is a file programming language detector based on github/linguist and src-d/enry.

Examples

$source_file = new ContentFile('Babelfish.php', \file_get_contents(__DIR__ . '/src/Babelfish/Babelfish.php'));
$language = Babelfish::getWithDefaultStrategies()->getLanguage($source_file);
if ($language !== null) {
    echo 'Language detected: ' . $language->getName();
}

How Babelfish works?

The language is determined by using an ordered set of strategies. Each strategy will either identify the precise language or reduce the number of likely languages for the next strategy. The default set of strategies is:

See also How Linguist works.