Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/shincurry/tokotohi

Hitokoto Node.js version
https://github.com/shincurry/tokotohi

hitokoto hitokoto-node

Last synced: 4 days ago
JSON representation

Hitokoto Node.js version

Awesome Lists containing this project

README

        

# Tokotohi
Hitokoto Node.js version

[中文](#chinese)

## Usage

### Sync Call

```

```

### Async Call

```
setTimeout(function() {
var scr = document.createElement('script');
scr.setAttribute('src','/hitokoto?callback=setHitokoto');
document.body.appendChild(scr);
},100);
```

### Callback

```
function setHitokoto(res) {
// do something...
}
```

## Tokotohi Module Usage

1. copy `module` into your project folder
2. insert `var hitokoto = require('./modules/hitokoto');` into your code
3. `hitokoto.getData(function(data) { // do something... });`
4. Done.

### block some keywords

```
setBlockedWords(array); // Array params
```

## Data Object Schema Example

```
var data = {
id : "123456789",
content : "赠人玫瑰,手有余香;还人玫瑰,手有余伤。",
source : "ShinCurry"
}
```

## Demo

[Windisco](https://windisco.com)

# Tokotohi 中文


Hitokoto Node.js version

[中文](#chinese)

## 调用方法

### 同步调用

```

```

### 异步调用

```
setTimeout(function() {
var scr = document.createElement('script');
scr.setAttribute('src','/hitokoto?callback=setHitokoto');
document.body.appendChild(scr);
},100);
```

### 回调函数

```
function setHitokoto(res) {
// do something...
}
```

## 模块的使用方法

1. 拷贝 `module` 文件夹到你自己的项目目录
2. 导入 Module `var hitokoto = require('./modules/hitokoto');`
3. 调用 `hitokoto.getData(function(data) { // do something... });`

### 屏蔽某些关键词

```
setBlockedWords(array); // 传入一个数组
```

## 获取数据的对象模型[舍去了部分无用数据]

```
var data = {
id : "123456789",
content : "赠人玫瑰,手有余香;还人玫瑰,手有余伤。",
source : "ShinCurry"
}
```