cmd

command
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

search.go implements a super simple location search by name.

The main elements are:

  1. Load TERC and SIMC data.
  2. Use data to create a tree like structure. root ─┬─ PODKARPACKIE ─┬─ Przemyśl │ └─ Rzeszów └ WARMIŃSKO-MAZURSKIE ─┬─ Elbląg ├─ Ełk └─ Olsztyn

3. From the tree like structure it creates a list of all nodes. 4. It starts a search loop.

Search is simple process:

  1. Read text from stdin, strip from whitespace
  2. Iterate over ALL nodes and compute a score: Levenstein distance between the last component of location and the input text.
  3. Sort all nodes based on the score.
  4. Print 10 results with lowest score.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL