zhloremipsum

package module
v0.0.0-...-535ed3f Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

Chinese (zh-Hant) Lorem Ipsum

簡介

Go Reference Apache 2.0 License

這是生成中文隨機文/句的專案。

關於文字檔案

char.txt

資料源於 CNS11643 中文標準交換碼全字庫

採用第一與第二字面的值。

又由於第一面部分為符號,所以特別篩選 unicode 0x4421 ~ 0x7D4B 之間的文字。

文字已經過 unicode 進行排序。

類似專案

Documentation

Overview

Example
package main

import (
	"fmt"
	"math/rand"

	zli "bitbucket.org/shiyou0130011/zh-lorem-ipsum"
)

func main() {
	rand.Seed(1)
	w := zli.Sentence
	s := ""

	const numOfWords = 10

	for i := 0; i < numOfWords; i++ {
		if i == numOfWords-1 && w == zli.VerbWithSentence {
			w = zli.Verb
		}
		s += w.String()
		w = w.Next()
		if i == numOfWords-1 {
			s += "。"
		}
	}
	fmt.Print(s)
	// Outputs: 能講紅它必不長!寡人喝黑洟水思索著:「看朕必然吃白色的喝?」瘋狂懺吃。
}
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Word

type Word interface {
	// return word's text
	String() string
	// next word
	Next() Word
}
var Adjective Word = &wordWithPrefixOrSuffix{}

形容詞

var Auxiliary Word = &simpleWord{}

助詞

var Noun Word = &multiTempWord{}

名詞

var Sentence Word = &sentance{}

句子

var Verb Word = &simpleWord{}

動詞

var VerbWithSentence Word = &beforeSentenceVerb{}

Jump to

Keyboard shortcuts

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