rwc

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

README

rwc License GoDoc Pipeline status

Package rwc provides a pseudo-Russian word constructor.

Install

go install gitlab.com/opennota/rwc@latest

Use

package main
import (
	"fmt"
	"gitlab.com/opennota/rwc"
)
func main() {
	fmt.Println(rwc.Word(7))
	fmt.Println(rwc.WordMask("зVC...я"))
}

See also

http://kirsanov.com/rwc/ (Eng)

Documentation

Overview

Package rwc provides a pseudo-Russian word constructor.

Index

Constants

This section is empty.

Variables

View Source
var DefaultConstructor = Constructor{
	// contains filtered or unexported fields
}

DefaultConstructor is the default word constructor.

Functions

func Word

func Word(length int) string

Word returns a pseudo-Russian word of the specified length.

func WordMask

func WordMask(mask string) string

WordMask returns a pseudo-Russian word matching the mask. The mask may contain lowercase letters from 'а' to 'я' (excluding 'ё') and the following special symbols: V - for a vowel; C - for a consonant; . (dot) - for any letter.

Types

type Constructor

type Constructor struct {
	// contains filtered or unexported fields
}

Constructor is a pseudo-Russian word constructor.

func (*Constructor) LearnFrom

func (c *Constructor) LearnFrom(r io.Reader) error

LearnFrom learns n-grams from an UTF-8 text it reads from r. One can call LearnFrom multiple times with different readers.

func (*Constructor) LoadFrom

func (c *Constructor) LoadFrom(r io.Reader) error

LoadFrom loads binary representation of Constructor from r.

func (*Constructor) LoadFromRWC

func (c *Constructor) LoadFromRWC(filename string) error

LoadFromRWC loads binary representation of Constructor from an .RWC file.

func (*Constructor) Source

func (c *Constructor) Source() []byte

Source returns the Go code for initializing Constructor, like the code you can see in the autogenerated.go

func (*Constructor) Word

func (c *Constructor) Word(n int) string

Word returns a pseudo-Russian word of the specified length.

func (*Constructor) WordMask

func (c *Constructor) WordMask(mask string) string

WordMask returns a pseudo-Russian word matching the mask. The mask may contain lowercase letters from 'а' to 'я' (excluding 'ё') and the following special symbols: V - for a vowel; C - for a consonant; . (dot) - for any letter.

func (*Constructor) WriteTo

func (c *Constructor) WriteTo(w io.Writer) (int64, error)

WriteTo writes binary representation of Constructor to w.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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