Skip to content

Commit 53671e7

Browse files
committed
Compare to other projects
1 parent e0ef493 commit 53671e7

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ Comparison to other projects on that dataset:
8888
|[benbalter/licensee](https://github.com/benbalter/licensee)| 75% (673/902) | 111 |
8989
|[google/licenseclassifier](https://github.com/google/licenseclassifier)| 76% (682/902) | 907 |
9090
|[boyter/lc](https://github.com/boyter/lc)| 88% (797/902) | 548 |
91+
|[amzn/askalono](https://github.com/amzn/askalono)| 87% (785/902) | 165 |
92+
|[LiD](https://source.codeaurora.org/external/qostg/lid)| 94% (847/902) | 3660 |
9193

9294
<details><summary>How this was measured</summary>
9395
<pre><code>$ cd $(go env GOPATH)/src/gopkg.in/src-d/go-license-detector.v2/licensedb
@@ -105,6 +107,15 @@ $ time find -type f -print | xargs -n1 -P4 identify_license \
105107
$ # boyter/lc
106108
$ time lc . \
107109
| grep -vE 'NOASSERTION|----|Directory' | cut -d" " -f1 | sort | uniq | wc -l
110+
$ # amzn/askalono
111+
$ echo '#!/bin/sh
112+
result=$(askalono id "$1")
113+
echo "$1
114+
$result"' > ../askalono.wrapper
115+
$ time find -type f -print | xargs -n1 -P4 sh ../askalono.wrapper | grep -Pzo '.*\nLicense: .*\n' askalono.txt | grep -av "License: " | cut -d/ -f 2 | sort | uniq | wc -l
116+
$ # LiD
117+
$ time license-identifier -I dataset -F csv -O lid
118+
$ cat lid_*.csv | cut -d, -f1 | cut -d"'" -f 2 | grep / | cut -d/ -f2 | sort | uniq | wc -l
108119
</code></pre>
109120
</details>
110121

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// +build make
2+
3+
package main
4+
5+
import (
6+
"encoding/csv"
7+
"encoding/json"
8+
"io/ioutil"
9+
"log"
10+
"os"
11+
"path"
12+
)
13+
14+
func main() {
15+
dir := os.Args[1]
16+
files, err := ioutil.ReadDir(dir)
17+
if err != nil {
18+
log.Fatalf("Listing %s: %v\n", dir, err)
19+
}
20+
writer := csv.NewWriter(os.Stdout)
21+
defer writer.Flush()
22+
for _, file := range files {
23+
var data map[string]interface{}
24+
content, err := ioutil.ReadFile(path.Join(dir, file.Name()))
25+
if err != nil {
26+
log.Fatalf("Reading %s: %v\n", file.Name(), err)
27+
}
28+
json.Unmarshal(content, &data)
29+
name := data["name"].(string)
30+
id := data["licenseId"].(string)
31+
writer.Write([]string{id, name})
32+
}
33+
}

0 commit comments

Comments
 (0)