Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

anagrammit-go -- Anagram Generation in Go

A pure Go anagram generation library. Useful for building command line tools or web services. Bring your own word lists.

An example.

// A basic command line anagram generator.

package main

import (
	"flag"
	"fmt"

	"github.com/abachman/anagrammit-go/anagrammit"
)

var p = flag.Parse

func main() {
	wordLen := flag.Int("wordlength", 3, "minimum word length")
	limit := flag.Int("limit", 10, "result limit, use 0 for unlimited")
	shuffle := flag.Bool("shuffle", false, "shuffle lexicon")
	flag.Parse()
	inpt := flag.Arg(0)

	args := &anagrammit.GeneratorArgs{
		WordLength:  *wordLen,
		ResultLimit: *limit,
		Shuffle:     *shuffle,
		WordsFile:   "tmp/dictionary.txt",
	}

	// Base
	generator := anagrammit.NewGenerator(args)

	output := make(chan string)
	generator.Generate(inpt, output)

	for msg := range output {
		fmt.Println(msg)
	}
}

Or, download and build the examples:

$ make generator
$ ./anagram-generator -limit=0 "pure soap union"

About

Generate all the anagrams.

Resources

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.