Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hthetiot committed Aug 5, 2014
0 parents commit 97d9fed
Show file tree
Hide file tree
Showing 93 changed files with 29,744 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# vim ancillary files
*.un~
*.swp
*.swo

# compiled python
*.pyc

# other stuff
*.zip
*.gz
*.tar
*.log
.DS_Store

# locally installed node modules
node_modules
build
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: node_js
node_js:
- "0.6"
- "0.8"
22 changes: 22 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
(MIT License)

Copyright (c) 2014 Harold Thetiot <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
**node-snowball** - bindings to the [libstemmer](http://snowball.tartarus.org/download.php) library.

npm install node-snowball

## Usage

```javascript
var snowball = require('snowball');
snowball.stem('stemming'); //stem
snowball.stem('stems'); //stem
snowball.stem('stemmed'); //stem
snowball.stem('phones'); //phone
```

## To compile, run

```
npm build .
```

## License

(MIT License)

Copyright (c) 2014 Harold Thetiot <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
44 changes: 44 additions & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"targets": [
{
"target_name": "snowball",
"sources": [
"src/libstemmer/libstemmer/libstemmer.c",
"src/libstemmer/runtime/api.c",
"src/libstemmer/runtime/utilities.c",
"src/libstemmer/src_c/stem_ISO_8859_1_danish.c",
"src/libstemmer/src_c/stem_ISO_8859_1_dutch.c",
"src/libstemmer/src_c/stem_ISO_8859_1_english.c",
"src/libstemmer/src_c/stem_ISO_8859_1_finnish.c",
"src/libstemmer/src_c/stem_ISO_8859_1_french.c",
"src/libstemmer/src_c/stem_ISO_8859_1_german.c",
"src/libstemmer/src_c/stem_ISO_8859_1_hungarian.c",
"src/libstemmer/src_c/stem_ISO_8859_1_italian.c",
"src/libstemmer/src_c/stem_ISO_8859_1_norwegian.c",
"src/libstemmer/src_c/stem_ISO_8859_1_porter.c",
"src/libstemmer/src_c/stem_ISO_8859_1_portuguese.c",
"src/libstemmer/src_c/stem_ISO_8859_1_spanish.c",
"src/libstemmer/src_c/stem_ISO_8859_1_swedish.c",
"src/libstemmer/src_c/stem_ISO_8859_2_romanian.c",
"src/libstemmer/src_c/stem_KOI8_R_russian.c",
"src/libstemmer/src_c/stem_UTF_8_danish.c",
"src/libstemmer/src_c/stem_UTF_8_dutch.c",
"src/libstemmer/src_c/stem_UTF_8_english.c",
"src/libstemmer/src_c/stem_UTF_8_finnish.c",
"src/libstemmer/src_c/stem_UTF_8_french.c",
"src/libstemmer/src_c/stem_UTF_8_german.c",
"src/libstemmer/src_c/stem_UTF_8_hungarian.c",
"src/libstemmer/src_c/stem_UTF_8_italian.c",
"src/libstemmer/src_c/stem_UTF_8_norwegian.c",
"src/libstemmer/src_c/stem_UTF_8_porter.c",
"src/libstemmer/src_c/stem_UTF_8_portuguese.c",
"src/libstemmer/src_c/stem_UTF_8_romanian.c",
"src/libstemmer/src_c/stem_UTF_8_russian.c",
"src/libstemmer/src_c/stem_UTF_8_spanish.c",
"src/libstemmer/src_c/stem_UTF_8_swedish.c",
"src/libstemmer/src_c/stem_UTF_8_turkish.c",
"src/snowball.cpp"
]
}
]
}
13 changes: 13 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var snowball = require('./build/Release/snowball'),
cache = {};

exports.stemword = function (word) {
if (typeof cache[word] !== 'undefined') {
return cache[word];
}
return cache[word] = snowball.stemword(word);
}

exports.emptyCache = function () {
cache = {};
}
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "snowball",
"version": "0.0.1",
"description": "This stemmming module for Node.js provides stemming capability for a variety of languages using Dr. M.F. Porter's Snowball API.",
"authors": [
"Harold Thetiot <[email protected]> (http://melchizetech.com)"
],
"repository": {
"type": "git",
"url": "https://github.com/hthetiot/node-snowball"
},
"licenses": [
{
"type": "MIT",
"url": "https://github.com/hthetiot/node-snowball/blob/master/LICENSE"
}
],

"main": "index.js",

"scripts": {
"test": "nodeunit test"
},
"devDependencies": {
"nodeunit": "*"
}
}
Binary file added src/.DS_Store
Binary file not shown.
18 changes: 18 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# vim ancillary files
*.un~
*.swp
*.swo

# compiled python
*.pyc

# other stuff
*.zip
*.gz
*.tar
*.log
.DS_Store?

# locally installed node modules
node_modules
build
72 changes: 72 additions & 0 deletions src/libstemmer/MANIFEST
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
README
src_c/stem_ISO_8859_1_danish.c
src_c/stem_ISO_8859_1_danish.h
src_c/stem_ISO_8859_1_dutch.c
src_c/stem_ISO_8859_1_dutch.h
src_c/stem_ISO_8859_1_english.c
src_c/stem_ISO_8859_1_english.h
src_c/stem_ISO_8859_1_finnish.c
src_c/stem_ISO_8859_1_finnish.h
src_c/stem_ISO_8859_1_french.c
src_c/stem_ISO_8859_1_french.h
src_c/stem_ISO_8859_1_german.c
src_c/stem_ISO_8859_1_german.h
src_c/stem_ISO_8859_1_hungarian.c
src_c/stem_ISO_8859_1_hungarian.h
src_c/stem_ISO_8859_1_italian.c
src_c/stem_ISO_8859_1_italian.h
src_c/stem_ISO_8859_1_norwegian.c
src_c/stem_ISO_8859_1_norwegian.h
src_c/stem_ISO_8859_1_porter.c
src_c/stem_ISO_8859_1_porter.h
src_c/stem_ISO_8859_1_portuguese.c
src_c/stem_ISO_8859_1_portuguese.h
src_c/stem_ISO_8859_1_spanish.c
src_c/stem_ISO_8859_1_spanish.h
src_c/stem_ISO_8859_1_swedish.c
src_c/stem_ISO_8859_1_swedish.h
src_c/stem_ISO_8859_2_romanian.c
src_c/stem_ISO_8859_2_romanian.h
src_c/stem_KOI8_R_russian.c
src_c/stem_KOI8_R_russian.h
src_c/stem_UTF_8_danish.c
src_c/stem_UTF_8_danish.h
src_c/stem_UTF_8_dutch.c
src_c/stem_UTF_8_dutch.h
src_c/stem_UTF_8_english.c
src_c/stem_UTF_8_english.h
src_c/stem_UTF_8_finnish.c
src_c/stem_UTF_8_finnish.h
src_c/stem_UTF_8_french.c
src_c/stem_UTF_8_french.h
src_c/stem_UTF_8_german.c
src_c/stem_UTF_8_german.h
src_c/stem_UTF_8_hungarian.c
src_c/stem_UTF_8_hungarian.h
src_c/stem_UTF_8_italian.c
src_c/stem_UTF_8_italian.h
src_c/stem_UTF_8_norwegian.c
src_c/stem_UTF_8_norwegian.h
src_c/stem_UTF_8_porter.c
src_c/stem_UTF_8_porter.h
src_c/stem_UTF_8_portuguese.c
src_c/stem_UTF_8_portuguese.h
src_c/stem_UTF_8_romanian.c
src_c/stem_UTF_8_romanian.h
src_c/stem_UTF_8_russian.c
src_c/stem_UTF_8_russian.h
src_c/stem_UTF_8_spanish.c
src_c/stem_UTF_8_spanish.h
src_c/stem_UTF_8_swedish.c
src_c/stem_UTF_8_swedish.h
src_c/stem_UTF_8_turkish.c
src_c/stem_UTF_8_turkish.h
runtime/api.c
runtime/api.h
runtime/header.h
runtime/utilities.c
libstemmer/libstemmer.c
libstemmer/libstemmer_utf8.c
libstemmer/modules.h
libstemmer/modules_utf8.h
include/libstemmer.h
10 changes: 10 additions & 0 deletions src/libstemmer/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include mkinc.mak
CFLAGS=-Iinclude -fPIC
all: libstemmer.o stemwords
libstemmer.o: $(snowball_sources:.c=.o)
$(AR) -cru $@ $^
cp libstemmer.o libstemmer.a
stemwords: examples/stemwords.o libstemmer.o
$(CC) -o $@ $^
clean:
rm -f stemwords *.o src_c/*.o runtime/*.o libstemmer/*.o *.a
Loading

0 comments on commit 97d9fed

Please sign in to comment.