New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

github.com/alanquatermain/go-trie

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/alanquatermain/go-trie

  • v0.0.0-20100720223728-423cc8d67b96
  • Source
  • Go
  • Socket score

Version published
Created
Source

h1=. Trie for Go

p=. Version 1.1 -- 20 July 2010

p=. By "Jim Dovey":mailto:jimdovey@mac.com

h2. Introduction

This project implements a Trie structure for the Go programming language, along with a customization of that structure designed for use with TeX-style hyphenation tables (where values need to be stored with each character).

The structures implemented here use Unicode runes instead of bytes for each item in the trie. This means that strings of Japanese kanji characters will use exactly one trie node per character, rather than one per byte of that character's UTF-8 representation. It also makes the trie itself relatively encoding-agnostic, since it will store UTF32 rune values, meaning that inputs can be compared against strings using any valid sequence of UTF-8 bytes which would resolve to the same UTF32 runes.

The Trie structure can optionally store a value with each inserted string. The value is of type interface{}, so anything will work. My "Hyphenator":http://github.com/AlanQuatermain/go-hyphenator uses vector.IntVector as the value for each string, for example.

There is one additional file, hyphen_trie.go, which implements a convenience for TeX-style hyphenation: it will accept a pattern string similar to that used by the above hyphenator package and will insert the string while attaching the numeric values at the end. This function might well be moved into hyphenator in the future; at present it's here because it can be more optimized at this level.

For more information on Tries, read "this Wikipedia article":http://en.wikipedia.org/wiki/Trie. For more information on TeX's use of tries for hyphenation, refer to the "original paper by Franklin Mark Liang":http://www.tug.org/docs/liang/liang-thesis.pdf.

h2. Installation

The simplest way to install is using goinstall:

goinstall "github.com/AlanQuatermain/go-trie"

This will install the package in such a way that it must be imported using the above quoted string as its import statement, i.e. import trie "github.com/AlanQuatermain/go-trie".

Alternatively you can clone the code directly and install it using make install. This will enable you to import it in your code using just import "trie".

FAQs

Package last updated on 20 Jul 2010

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc