@ohos-ports/node-postal 1.3.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +112 -0
- package/build/Release/expand.node +0 -0
- package/build/Release/parser.node +0 -0
- package/index.js +5 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2015 openvenues
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
node-postal
|
|
2
|
+
-----------
|
|
3
|
+
|
|
4
|
+
[](https://travis-ci.org/openvenues/node-postal) [](https://www.npmjs.com/package/node-postal)
|
|
5
|
+
|
|
6
|
+
These are the NodeJS bindings to [libpostal](https://github.com/openvenues/libpostal), a fast, multilingual NLP library for parsing/normalizing physical addresses. libpostal is written in C because virtually every other language can bind to C.
|
|
7
|
+
|
|
8
|
+
Usage
|
|
9
|
+
-----
|
|
10
|
+
|
|
11
|
+
```node
|
|
12
|
+
var postal = require('node-postal');
|
|
13
|
+
|
|
14
|
+
// Expansion API
|
|
15
|
+
postal.expand.expand_address('V XX Settembre, 20');
|
|
16
|
+
|
|
17
|
+
// Parser API
|
|
18
|
+
postal.parser.parse_address('Barboncino (first unionized pizza place in NYC), 781 Franklin Ave, Crown Heights, Brooklyn, NY 11238');
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Installation
|
|
22
|
+
------------
|
|
23
|
+
|
|
24
|
+
Before using the Node bindings, you must install the libpostal C library. Make sure you have the following prerequisites:
|
|
25
|
+
|
|
26
|
+
**On Ubuntu/Debian**
|
|
27
|
+
```
|
|
28
|
+
sudo apt-get install curl autoconf automake libtool pkg-config
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**On CentOS/RHEL**
|
|
32
|
+
```
|
|
33
|
+
sudo yum install curl autoconf automake libtool pkgconfig
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**On Mac OSX**
|
|
37
|
+
```
|
|
38
|
+
brew install curl autoconf automake libtool pkg-config
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
**Installing libpostal**
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
git clone https://github.com/openvenues/libpostal
|
|
45
|
+
cd libpostal
|
|
46
|
+
./bootstrap.sh
|
|
47
|
+
./configure --datadir=[...some dir with a few GB of space...]
|
|
48
|
+
make
|
|
49
|
+
sudo make install
|
|
50
|
+
|
|
51
|
+
# On Linux it's probably a good idea to run
|
|
52
|
+
sudo ldconfig
|
|
53
|
+
```
|
|
54
|
+
**Install node-gyp**
|
|
55
|
+
|
|
56
|
+
Then install node-gyp system-wide:
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
sudo npm install -g node-gyp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Installing node-gyp on Linux (Ubuntu)**
|
|
63
|
+
|
|
64
|
+
First make sure you have:
|
|
65
|
+
|
|
66
|
+
1. gcc, g++ and make (```sudo apt-get install build-essential``` on Ubuntu)
|
|
67
|
+
2. NodeJS with all the development headers (if using a package manager like apt-get, follow the instructions here: https://nodejs.org/en/download/package-manager/)
|
|
68
|
+
3. python 2.7
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
**Installing the Node bindings**
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
npm install node-postal
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Compatibility
|
|
78
|
+
-------------
|
|
79
|
+
|
|
80
|
+
node-postal is tested on most major versions of Node (0.10+) in continuous integration. The C++ bindings are written using [Nan](https://github.com/nodejs/nan), which abstracts the API changes across various versions of V8, so the latest versions of Node will likely work.
|
|
81
|
+
|
|
82
|
+
If you're having trouble compiling, post a Github issue with your OS and Node versions along with the output of npm install / node-gyp rebuild.
|
|
83
|
+
|
|
84
|
+
Tests
|
|
85
|
+
-----
|
|
86
|
+
|
|
87
|
+
To run the unit tests:
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
npm test
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Troubleshooting
|
|
94
|
+
---------------
|
|
95
|
+
**Installing [libpostal](https://github.com/openvenues/libpostal):**
|
|
96
|
+
node-postal is a thin wrapper around libpostal, which is written in C. Installing node-postal with npm will not install libpostal as a dependency. The install steps described above will install it in standard locations for your OS. For OS X and Linux, that's `/usr/local/include` and `/usr/local/lib`. node-postal will look in these locations for the C libraries. If you have problems installing node-postal, check there for recently installed libpostal libraries.
|
|
97
|
+
|
|
98
|
+
**Downloading Large Files**
|
|
99
|
+
The ```make``` process downloads ~750MB of data, ~2GB unzipped (note: these are production-quality machine learning models trained on over a billion addresses, that's how much disk/memory it takes). Make sure the --datadir argument to ```configure```, which requires an absolute path, has enough room to accommodate the models. If you get errors after downloading, e.g.:
|
|
100
|
+
```
|
|
101
|
+
make[3]: *** [all-local] Error 1
|
|
102
|
+
make[2]: *** [all-recursive] Error 1
|
|
103
|
+
make[1]: *** [all-recursive] Error 1
|
|
104
|
+
make: *** [all] Error 2
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
there may be problems with subsequent install steps. Occasionally something will go wrong and it will give up downloading. Once downloading is complete, the make script will unpack the langauge_classifier.tar.gz.X files. If you see these files, your download may have stopped. Try running the make script again.
|
|
108
|
+
|
|
109
|
+
Special Thanks
|
|
110
|
+
--------------
|
|
111
|
+
|
|
112
|
+
Lucas Hrabovsky (https://github.com/imlucas) for information and examples of repos using Nan, node-gyp, etc.
|
|
Binary file
|
|
Binary file
|
package/index.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ohos-ports/node-postal",
|
|
3
|
+
"version": "1.3.0-beta.0",
|
|
4
|
+
"author": "Al Barrentine (@thatdatabaseguy)",
|
|
5
|
+
"description": "International address parsing/normalization at C speed",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"libpostal",
|
|
10
|
+
"addresses",
|
|
11
|
+
"address parsing",
|
|
12
|
+
"i18n",
|
|
13
|
+
"geo",
|
|
14
|
+
"deduping",
|
|
15
|
+
"machine learning",
|
|
16
|
+
"natural language processing",
|
|
17
|
+
"nlp",
|
|
18
|
+
"c"
|
|
19
|
+
],
|
|
20
|
+
"homepage": "https://github.com/openvenues/node-postal",
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "https://github.com/ohos-ports/ohos-ports.git",
|
|
24
|
+
"directory": "ports/node-postal/1.3.0"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"bindings": "^1.5.0",
|
|
28
|
+
"nan": "^2.22.0"
|
|
29
|
+
},
|
|
30
|
+
"devDependencies": {
|
|
31
|
+
"mocha": "^7.1.1",
|
|
32
|
+
"simplesets": "^1.2.0"
|
|
33
|
+
},
|
|
34
|
+
"scripts": {
|
|
35
|
+
"test": "mocha ./test"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"index.js",
|
|
39
|
+
"build/Release/*.node"
|
|
40
|
+
]
|
|
41
|
+
}
|