guillermobt/babelfish
Composer 安装命令:
composer require guillermobt/babelfish
包简介
A file programming language detector
README 文档
README
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:
- Vim or Emacs modeline
- commonly used filename
- shell shebang
- file extension
- XML header
- heuristics
- naïve Bayesian classification
See also How Linguist works.
统计信息
- 总下载量: 8
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-21