svgtree

command module
v0.0.0-...-bbead5a Latest Latest
Warning

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

Go to latest
Published: May 11, 2022 License: MIT Imports: 9 Imported by: 0

README

SvgTree

Display a binary tree with SVG

Here is a complete GO program which reads a document and produces an alphabetized list of words found therein together with the number of occurrences of each word.

The method keeps a binary tree of words such that the left descendant tree for each word has all the words lexicographically smaller than the given word, and the right descendant has all the larger words.

Both the insertion and the drawing routine are recursive.

Finally, the program send the SVG associated with the tree to the browser to display.

Install

Select or create a folder :

cd myfloder

Clone the project into your selected folder :

git clone git@github.com:EasyGithDev/SvgTree.git svgtree

Install the depencies to work with SVG :

cd svgtree
go mod init
go get github.com/ajstarks/svgo

Run

You may execute the program with a short text as parameter :

go run main.go this is time to said hello world one more time

alt text

If you want display the words frequencies use the -d option like this :

go run main.go -d=f this is time to said hello world one more time

alt text

If you want display the node position use the -d option like this :

go run main.go -d=p this is time to said hello world one more time

alt text

Display the result

Open a web browser and enter the URL :

http://localhost:8000/

Write the result

You can choose to generate a SGV file to save the result.

You must change the output like this :

go run main.go -o=stdout this is time to said hello world one more time > tree.svg

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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