Zenrei is a service that can search the use history of class name, method name, and variable name from GitHub's most starred repositories.
GitHubのスター数上位のリポジトリから,クラス名・メソッド名・変数名の使用実績を検索できるサービスです.
Available at https://zenrei.nyamikan.net/
Returns use places of the specified name.
$ curl https://zenrei.nyamikan.net/v1/search?q=test_method
{
"test_method": [
{
"Repository": "oracle/truffleruby",
"Filename": "tool/parse_mri_errors.rb",
"Type": 31,
"Name": "test_method"
},
{
"Repository": "ruby/ruby",
"Filename": "sample/simple-bench.rb",
"Type": 30,
"Name": "test_methods"
}
]
}
Parameter | Type | Description |
---|---|---|
q | string | name (case sensitive, forward match) |
Key | Type | Description |
---|---|---|
Repository | String | repository name |
Filename | String | file path in repository |
Type | Number | name type 10: class 11: module 20: method 30: variable 31: parameter 32: instance variable 33: global variable 34: class variable |
Name | String | class/method/variable name |
Returns the usage frequencies of the specified name.
$ curl https://zenrei.nyamikan.net/v1/suggest?q=ssl_context
[
{
"Name": "ssl_context",
"Type": 0,
"Count": 42
},
{
"Name": "ssl_context_without_verify",
"Type": 0,
"Count": 2
},
{
"Name": "ssl_context_with_verify",
"Type": 0,
"Count": 2
}
]
Parameter | Type | Description |
---|---|---|
q | string | name (case insensitive, forward match) |
Key | Type | Description |
---|---|---|
Name | String | class/method/variable name |
Type | Number | name type (unused) |
Count | Number | number of use |
Returns the synonyms of the specified name.
$ curl https://zenrei.nyamikan.net/v1/synonym?q=estimated
[
{
"Synset": "05803379-n",
"Lang": "eng",
"Name": "estimation"
},
{
"Synset": "05803379-n",
"Lang": "eng",
"Name": "estimate"
},
{
"Synset": "05803379-n",
"Lang": "jpn",
"Name": "見積り"
},
{
"Synset": "05803379-n",
"Lang": "jpn",
"Name": "値踏み"
}
]
Parameter | Type | Description |
---|---|---|
q | string | name (will be converted to lemma) |
Key | Type | Description |
---|---|---|
Synset | String | synonym group name |
Lang | String | language ("eng" or "jpn") |
Name | String | synonym name |
API server
- Download
wnjpn.db
(Japanese WordNet and English WordNet in an sqlite3 database) from http://compling.hss.ntu.edu.sg/wnja/ toapi/
- Rename
mongo/mongod.conf.example
tomongo/mongod.conf
- Rename
database.yml.example
todatabase.yml
(used by scripts increator/
) - Start servers: Run
docker-compose up
- Create collections: Run
creator/retreiver.rb
,creator/parser.rb
andcreator/indexer.rb
with bundler. - Try access: http://localhost:8080/v1/search?q=test
View server (for development)
- Change URL in
view/src/components/SearchBar.vue
(prefixhttp://localhost:8080/
) - Change directory to
view/
- Run
npm run serve
- Try access: http://localhost:8081/