3个版本
使用旧的Rust 2015
0.0.2 | 2017年9月26日 |
---|---|
0.0.2-alpha | 2017年9月13日 |
0.0.1 | 2017年9月13日 |
#21 在 #spdx
23 每月下载
710KB
549 行
FOSSlim
FOSSlim代表 Free Open Source Software LIcense Matcher(开源软件许可证匹配器),它将OSS许可证文本与SPDX id匹配,但用户可以轻松更改和更新训练数据,包括附加的EULAs和许可证文本;
它被设计成模块化,并提供许多底层高速实用工具,这些工具对用Ruby & Javascript等高级语言编写的库有很大帮助;这意味着您可以利用这里实现的多种模型,但它们单独不足以提供高置信度的响应。这项任务留给了RubyGem & NPM包,它们清理原始文本并从多个模型中合并结果以提高匹配结果的置信度;
它仍在积极开发中,但将以以下方式发布
Rust库(里程碑.1,里程碑.3)RoR宝石(示例API 里程碑.2)- LicenseMatcher宝石- 使用GEM的示例RoR应用程序 - Fosslim.com
... 待定 = 发布时间未知:优先级取决于社区的兴趣 4. NodeJS库和示例AWS lambda函数,待定 5. Rust微服务,待定 6. 命令行工具以扫描文件,待定
模型
- NaiveTF - 使用简单的WordBag模型,并通过Jaccard相似度对结果进行排序
- FingerNgram - 将文本分割为重叠的Ngrams,并为选定的NGrams生成指纹;
... 在不久的将来
- TF/IDF模型与余弦相似度
- Okapi25模型
- Winnowing模型
- 简单的概率ML模型 ~ Naive Bayes,HMM,...?
用法
use fosslim::index;
use fosslim::document::Document;
use fosslim::naive_tf; // Simple wordbag model with Jaccard similarity
...
let idx_file_path = "data/index.msgpack"; // it is pre-built index from SPDX data, includes ~300 licenses
let mit_txt = r#"
Permission is hereby granted, free of charge, to any person obtaining a copy of this software \
and associated documentation files (the "Software"), to deal in the Software without restriction,\
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,\
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,\
subject to the following conditions:\
"#;
let doc1 = Document::new(0, "mit".to_string(), mit_txt.to_string());
// matching document with SPDX label
if let Ok(idx) = index::load(idx_file_path) {
let mdl = naive_tf::from_index(&idx);
mdl::match_document(&doc1);
}
...
检查 tests
文件夹以获取更多用法示例;
是的,您可以使用 index::build_from_path()
函数构建自己的索引;您只需使用与 data/licenses
文件夹中的JSON文件相同的文件结构即可;
当前替代方案
以下是您现在可以使用的部分替代方案
- SPDX查找 - https://github.com/bbqsrc/spdx-lookup-python
- LibrariesIO许可证标准化器 - https://github.com/librariesio/spdx
- Google的许可证分类器 - https://github.com/google/licenseclassifier
- Fossology - https://github.com/fossology/fossology
- LicenseFinder - https://github.com/pivotal/LicenseFinder
依赖项
~1.2–2.2MB
~45K SLoC