shamanjs

所属分类:编程语言基础
开发工具:JavaScript
文件大小:0KB
下载次数:0
上传日期:2023-01-03 16:03:41
上 传 者sh-1993
说明:  用JavaScript实现的编程语言检测器
(Programming language detector implemented in JavaScript)

文件列表:
.babelrc (38, 2021-08-17)
.travis.yml (84, 2021-08-17)
LICENSE (1060, 2021-08-17)
dist/ (0, 2021-08-17)
dist/shaman.js (617468, 2021-08-17)
gulpfile.babel.js (531, 2021-08-17)
package-lock.json (210289, 2021-08-17)
package.json (567, 2021-08-17)
src/ (0, 2021-08-17)
src/index.js (4272, 2021-08-17)
src/model.json (617827, 2021-08-17)
test/ (0, 2021-08-17)
test/testShaman.js (1959, 2021-08-17)

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Prev/shamanjs/blob/master/LICENSE) [![Build Status](https://travis-ci.org/Prev/shamanjs.svg)](https://travis-ci.org/Prev/shamanjs) [![npm version](https://badge.fury.io/js/shamanld.svg)](https://www.npmjs.com/package/shamanld) # ShamanJS Programming Language Detector implemented in JavaScript. Based on the repository [shaman](https://github.com/Prev/shaman), which is written in Python. Languages supported: `ASP`, `Bash`, `C`, `C#`, `CSS`, `HTML`, `Java`, `JavaScript`, `Objective-c`, `PHP`, `Python`, `Ruby`, `SQL`, `Swift`, and `XML`. Pre-trained model is included in this library, where the size of the model is **617KB**. The accuracy of the model is **78%**, where the model is trained with 120K codes and tested with 40K codes. Note that the included model consists of many raw texts, so enabling compression (e.g., gzip) on the CDN when serving the JS file greatly affects the time and cost to download the file. (**175KB** when using gzip compression) See demo on [RunKit](https://runkit.com/prev/runkit-npm-shamanld). ## Getting Started ### Installation In a browser: ```html ``` Using npm: ```bash $ npm i --save shamanld ``` ### How to use ```javascript const code = ` #include int main() { printf("Hello world"); }`; const r = Shaman.detect(code); // r = [['c', 44.28, 'java', 6.3, ...]] const detectedLanguage = r[0][0]; assert(detectedLanguage == 'c'); ```

近期下载者

相关文件


收藏者