This repository has been archived by the owner. It is now read-only.

postal

Crystal bindings for libpostal [Mirror]

postal

Crystal bindings for libpostal

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      postal:
        git: https://codeberg.org/skinnyjames/postal.git
    
  2. Run shards install

Usage

Example http parsing server

require "postal"
require "http/server"
require "json"

worker = Postal::Worker.new("/opt/geoffrey/embedded/share/libpostal")

server = HTTP::Server.new do |context|
  add = context.request.query_params["add"]? || "123 Maine st, Quincy IL 62301"

  arr = worker.expand(add).map(&.parsed)

  context.response.content_type = "application/json"
  context.response.print arr.to_json
end

server.bind_tcp 8081
server.listen

Development

Upcoming

Contributors

Repository

postal

Owner
Statistic
  • 1
  • 0
  • 0
  • 0
  • 0
  • over 1 year ago
  • March 5, 2023
License

MIT License

Links
Synced at

Thu, 21 Nov 2024 12:03:43 GMT

Languages