0.0.0 • Published 8 years ago

@datagica/parse-location v0.0.0

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
8 years ago

@datagica/parse-location

Parse the first found location in a document.

Installation

$ npm install --save @datagica/parse-location

Usage

import parseLocation from "@datagica/parse-location";

parseLocation("Pierre Dupont. 12345. Saint-léger-du-malzieu en France.").then(..).catch(..)
// will output:
{
  "ngram": "Saint-léger-du-malzieu en France.",
  "value": {
    "id": "fr-saint-léger-du-malzieu",
    "countryCode": "FR",
    "country": "France",
    "name": {
      "en": "Saint-léger-du-malzieu, France"
    },
    "aliases": ["Saint-léger-du-malzieu France"],
    "location": [44.8881, 3.3094]
  },
  "len": 3,
  "errorLengthRatio": 0.1,
  "position": {
    "substring": {
      "begin": 22,
      "end": 55
    },
    "fullstring": {
      "begin": 22,
      "end": 55
    }
  }
}
// pretty cool right?