Skip to content

Commit

Permalink
Add tooling for TravisCI, Codecov.io
Browse files Browse the repository at this point in the history
Added npm scripts for getting coverage reports
Setup Travis yml file to support CI
  • Loading branch information
zurawiki committed Dec 30, 2017
1 parent f730735 commit 74b08f3
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
@@ -1,3 +1,4 @@
coverage
node_modules node_modules
.DS_Store .DS_Store
public_html public_html
Expand All @@ -7,4 +8,4 @@ study.js
owntest.js owntest.js
bugfixes.txt bugfixes.txt
owndata owndata
test.js test.js
9 changes: 9 additions & 0 deletions .travis.yml
@@ -0,0 +1,9 @@
language: node_js
node_js:
- "node"
- "6"
- "4"
script:
- npm test -- --coverage
after_success:
- bash <(curl -s https://codecov.io/bash)
27 changes: 16 additions & 11 deletions README.md
@@ -1,5 +1,10 @@
# HanziJS # HanziJS


[![NPM version](https://img.shields.io/npm/v/hanzi.svg?style=flat-square)](https://npmjs.org/package/hanzi)
[![Build Status](https://img.shields.io/travis/nieldlr/Hanzi/master.svg?style=flat-square)](https://travis-ci.org/nieldlr/hanzi)
[![Coverage Status](https://img.shields.io/codecov/c/github/nieldlr/hanzi/master.svg?style=flat-square)](https://codecov.io/gh/nieldlr/hanzi/branch/master)
[![codecov](https://codecov.io/gh/nieldlr/Hanzi/branch/master/graph/badge.svg)](https://codecov.io/gh/nieldlr/Hanzi)

HanziJS is a Chinese character and NLP module for Chinese language processing for Node.js. It is primarily written to help provide a framework for Chinese language learners to explore Chinese. HanziJS is a Chinese character and NLP module for Chinese language processing for Node.js. It is primarily written to help provide a framework for Chinese language learners to explore Chinese.


At present features include: At present features include:
Expand Down Expand Up @@ -37,12 +42,12 @@ hanzi.start();


#### hanzi.decompose(character, type of decomposition); #### hanzi.decompose(character, type of decomposition);


A function that takes a Chinese character and returns an object with decomposition data. Type of decomposition is optional. A function that takes a Chinese character and returns an object with decomposition data. Type of decomposition is optional.


Type of decomposition levels: Type of decomposition levels:


* 1 - "Once" (only decomposes character once), * 1 - "Once" (only decomposes character once),
* 2 - "Radical" (decomposes character into its lowest radical components), * 2 - "Radical" (decomposes character into its lowest radical components),
* 3 - "Graphical" (decomposes into lowest forms, will be mostly strokes and small indivisable units) * 3 - "Graphical" (decomposes into lowest forms, will be mostly strokes and small indivisable units)


```javascript ```javascript
Expand Down Expand Up @@ -70,17 +75,17 @@ A function that takes a string of characters and returns one object for all char
var decomposition = hanzi.decomposeMany('爱橄黃'); var decomposition = hanzi.decomposeMany('爱橄黃');
console.log(decomposition); console.log(decomposition);


{ '': { '':
{ character: '', { character: '',
components1: [ 'No glyph available', '' ], components1: [ 'No glyph available', '' ],
components2: [ '', '', '𠂇', '' ], components2: [ '', '', '𠂇', '' ],
components3: [ '', '', '𠂇', '', '' ] }, components3: [ '', '', '𠂇', '', '' ] },
'': '':
{ character: '', { character: '',
components1: [ '', '' ], components1: [ '', '' ],
components2: [ '', 'No glyph available', '', '' ], components2: [ '', 'No glyph available', '', '' ],
components3: [ '', '', '', '', '', '', '', '丿', '', '' ] }, components3: [ '', '', '', '', '', '', '', '丿', '', '' ] },
'': '':
{ character: '', { character: '',
components1: [ '廿', 'No glyph available' ], components1: [ '廿', 'No glyph available' ],
components2: [ '' ], components2: [ '' ],
Expand Down Expand Up @@ -125,7 +130,7 @@ console.log(hanzi.definitionLookup('雪'));


#### hanzi.dictionarySearch(characters, search type); #### hanzi.dictionarySearch(characters, search type);


Searches the dictionary based on input. Search type changes what data it returns. Defaults to Searches the dictionary based on input. Search type changes what data it returns. Defaults to


Search type paramaters: Search type paramaters:


Expand Down Expand Up @@ -282,7 +287,7 @@ console.log(hanzi.segment("我們都是陌生人。"));


#### hanzi.getPinyin(character); #### hanzi.getPinyin(character);


Returns all possible pinyin data for a character. Returns all possible pinyin data for a character.


```javascript ```javascript
console.log(hanzi.getPinyin('')); console.log(hanzi.getPinyin(''));
Expand Down Expand Up @@ -349,7 +354,7 @@ The object returned is organized by the possible pronunciations of the character
```javascript ```javascript
console.log(hanzi.determinePhoneticRegularity('')); console.log(hanzi.determinePhoneticRegularity(''));


{ yang2: { yang2:
{ character: '', { character: '',
component: [ '', '', '', '', '', '' ], component: [ '', '', '', '', '', '' ],
phoneticpinyin: [ 'shui3', 'Yang2', 'yang2', 'shui3', 'Yang2', 'yang2' ], phoneticpinyin: [ 'shui3', 'Yang2', 'yang2', 'shui3', 'Yang2', 'yang2' ],
Expand All @@ -374,7 +379,7 @@ HanziJS is used in the following projects:


## Contributors ## Contributors


* [nieldlr (Author)](http://github.com/nieldlr) * [nieldlr (Author)](http://github.com/nieldlr)
* [djuretic](http://github.com/djuretic) * [djuretic](http://github.com/djuretic)
* [nikdvp](http://github.com/nikvdp) * [nikdvp](http://github.com/nikvdp)
* [hermanschaaf](http://github.com/hermanschaaf) * [hermanschaaf](http://github.com/hermanschaaf)
Expand Down
4 changes: 3 additions & 1 deletion package.json
Expand Up @@ -16,7 +16,9 @@
}, },
"scripts": { "scripts": {
"test": "jest", "test": "jest",
"precommit": "lint-staged" "precommit": "lint-staged",
"coverage": "npm test -- --coverage",
"postcoverage": "opn coverage/lcov-report/index.html"
}, },
"lint-staged": { "lint-staged": {
"{index.js,*.json,lib/*.js,test/*.js}": ["prettier --write", "git add"] "{index.js,*.json,lib/*.js,test/*.js}": ["prettier --write", "git add"]
Expand Down

0 comments on commit 74b08f3

Please sign in to comment.