cmd

package
v0.0.0-...-1cd3302 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DistanceCmd = &cobra.Command{
	Use:     "distance",
	Short:   "Estimate the distance between words",
	Long:    "Estimate the distance between words",
	Example: "  word-embedding distance -i example/word_vectors.txt microsoft",
	PreRun: func(cmd *cobra.Command, args []string) {
		distanceBind(cmd)
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		if len(args) == 1 {
			return runDistance(args[0])
		}
		return errors.New("Input a single word")
	},
}

DistanceCmd is the command for calculation of similarity.

View Source
var GloveCmd = &cobra.Command{
	Use:   "glove",
	Short: "Embed words using glove",
	Long:  "Embed words using glove",
	PreRun: func(cmd *cobra.Command, args []string) {
		configBind(cmd)
		gloveBind(cmd)
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		if viper.GetBool(config.Prof.String()) {
			f, err := os.Create("cpu.prof")
			if err != nil {
				os.Exit(1)
			}
			pprof.StartCPUProfile(f)
			defer pprof.StopCPUProfile()
		}

		return runGlove()
	},
}

GloveCmd is for Glove command.

View Source
var RootCmd = &cobra.Command{
	Use:   "word-embedding",
	Short: "The tools embedding words into vector space",
	Long:  "The tools embedding words into vector space",
	RunE: func(cmd *cobra.Command, args []string) error {
		return errors.New("Set sub-command from: distance|word2vec")
	},
}

RootCmd is the root command for word embedding.

View Source
var Word2VecCmd = &cobra.Command{
	Use:   "word2vec",
	Short: "Embed words using word2vec",
	Long:  "Embed words using word2vec",
	PreRun: func(cmd *cobra.Command, args []string) {
		configBind(cmd)
		word2vecBind(cmd)
	},
	RunE: func(cmd *cobra.Command, args []string) error {
		if viper.GetBool(config.Prof.String()) {
			f, err := os.Create("cpu.prof")
			if err != nil {
				os.Exit(1)
			}
			pprof.StartCPUProfile(f)
			defer pprof.StopCPUProfile()
		}

		return runWord2Vec()
	},
}

Word2VecCmd is the word2vec command.

Functions

func ConfigFlagSet

func ConfigFlagSet() *pflag.FlagSet

ConfigFlagSet creates the common config flags.

Types

This section is empty.

Jump to

Keyboard shortcuts

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