util

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2017 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GenderMap = FeatureLookup{
		UDName: "Gender",
		ValueMap: map[string]string{
			"F": "Fem",
			"M": "Masc",
		},
	}
	NumberMap = FeatureLookup{
		UDName: "Number",
		ValueMap: map[string]string{
			"S":              "Sing",
			"P":              "Plur",
			"D":              "Dual",
			"Underspecified": "Underspecified",
		},
	}
	PersonMap = FeatureLookup{
		UDName: "Person",
		ValueMap: map[string]string{
			"1": "1",
			"2": "2",
			"3": "3",
			"A": "1,2,3",
		},
	}
	DefMap = FeatureLookup{
		UDName: "Definite",
		ValueMap: map[string]string{
			"D": "Def",
			"-": "Ind",
		},
	}
	PolarMap = FeatureLookup{
		UDName: "Polarity",
		ValueMap: map[string]string{
			"pos": "Pos",
			"neg": "Neg",
		},
	}
	TenseMap = FeatureLookup{
		UDName: "Tense",
		ValueMap: map[string]string{
			"PAST":       "Past",
			"PRESENT":    "Pres",
			"FUTURE":     "Fut",
			"IMPERATIVE": "Imp",

			"BEINONI": "Pres",
		},
	}
	TypeMap = FeatureLookup{
		UDName: "PronType",
		ValueMap: map[string]string{
			"DEM":  "Dem",
			"IMP":  "Ind",
			"PERS": "Prs",
			"REF":  "Prs",
		},
	}
	HEB2UDFeatureNameLookup = map[string]FeatureLookup{
		"gen":   GenderMap,
		"num":   NumberMap,
		"per":   PersonMap,
		"def":   DefMap,
		"tense": TenseMap,
		"type":  TypeMap,
		"polar": PolarMap,
	}
	HEB2UDPrefixPOS = map[string]string{
		"ADVERB":      "ADP",
		"CONJ":        "CONJ",
		"DEF":         "DET",
		"PREPOSITION": "ADP",
		"REL":         "SCONJ",
		"TEMP":        "SCONJ",
	}
	HEB2UDPOS = map[string]string{
		"AT":       "PART-Case=Acc",
		"BN":       "VERB-VerbForm=Part",
		"BNT":      "VERB-Definite=Cons|VerbForm=Part",
		"CC":       "CCONJ",
		"CC-SUB":   "SCONJ",
		"CC-COORD": "SCONJ",
		"CC-REL":   "SCONJ",
		"CD":       "NUM",
		"CDT":      "NUM-Definite=Cons",
		"COP":      "AUX-VerbType=Cop",
		"DT":       "DET-Definite=Cons",
		"DTT":      "DET-Definite=Cons",
		"EX":       "VERB-HebExistential=True",
		"IN":       "ADP",
		"INTJ":     "INTJ",
		"JJ":       "ADJ",
		"JJT":      "ADJ-Definite=Cons",
		"MD":       "AUX-VerbType=Mod",
		"NEG":      "ADV",
		"NN":       "NOUN",
		"NNP":      "PROPN",
		"NNT":      "NOUN-Definite=Cons",
		"NNPT":     "PROPN-Abbvr=Yes",
		"P":        "ADV-Prefix=Yes",
		"POS":      "PART-Case=Gen",
		"PRP":      "PRON",
		"QW":       "ADV-PronType=Int",
		"RB":       "ADV-Polarity=Neg",
		"TTL":      "NOUN-Title=Yes",
		"VB":       "VERB",
	}
)
View Source
var Testers = []RuneTester{
	IsDigit,
	IsGraphic,
	IsLetter,
	IsLower,
	IsMark,
	IsNumber,
	IsPunct,
	IsSymbol,
	IsTitle,
	IsUpper,
}

Functions

func AbsInt

func AbsInt(x int) int

func AddToFeatureStr added in v1.2.0

func AddToFeatureStr(featureStr, newFeature string) string

func DelFromFeatureMapAndStr added in v1.2.0

func DelFromFeatureMapAndStr(features map[string]string, featureStr, delFeature string) (map[string]string, string)

func Heb2UDFeature added in v1.2.0

func Heb2UDFeature(feature string) string

func Heb2UDFeaturesString added in v1.2.0

func Heb2UDFeaturesString(features string) string

func LocateFile added in v1.2.1

func LocateFile(name string, subDirs []string) (path string, found bool)

func LogMemory

func LogMemory()

func MD5File

func MD5File(fileName string) (string, error)

func Max

func Max(a, b int) int

func MaxInt

func MaxInt(v []int) (retval int)

func MergeFeatureStrs added in v1.2.0

func MergeFeatureStrs(feat1, feat2 string) (string, map[string]string)

func Min

func Min(a, b int) int

func NotDigitOrNeg

func NotDigitOrNeg(c rune) bool

func Prefix

func Prefix(s string, n int) string

func RangeInt

func RangeInt(to int) []int

func Sign

func Sign(x int) int

func Signature

func Signature(s string) string

func Strcmp

func Strcmp(a, b string) int

func Suffix

func Suffix(s string, n int) string

func TestEach

func TestEach(t RuneTester, s string) byte

func UniqueSortedStrings added in v1.2.0

func UniqueSortedStrings(sorted []string) []string

Types

type ByGeneric

type ByGeneric []Generic

func (ByGeneric) Len

func (b ByGeneric) Len() int

func (ByGeneric) Less

func (b ByGeneric) Less(i, j int) bool

func (ByGeneric) Swap

func (b ByGeneric) Swap(i, j int)

type EnumSet

type EnumSet struct {
	Enum   map[interface{}]int
	Index  []interface{}
	Frozen bool
	// contains filtered or unexported fields
}

func NewEnumSet

func NewEnumSet(capacity int) *EnumSet

func (*EnumSet) Add

func (e *EnumSet) Add(value interface{}) (int, bool)

func (*EnumSet) IndexOf

func (e *EnumSet) IndexOf(value interface{}) (int, bool)

func (*EnumSet) Len

func (e *EnumSet) Len() int

func (*EnumSet) Print

func (e *EnumSet) Print()

func (*EnumSet) RebuildIndex

func (e *EnumSet) RebuildIndex()

func (*EnumSet) ValueOf

func (e *EnumSet) ValueOf(index int) interface{}

type Equaler

type Equaler interface {
	Equal(Equaler) bool
}

type FeatureLookup added in v1.2.0

type FeatureLookup struct {
	UDName   string
	ValueMap map[string]string
}

type Format

type Format interface {
	Format(value interface{}) string
}

type Generic

type Generic struct {
	Key   string
	Value interface{}
}

type Persist

type Persist interface {
	Read(reader io.Reader)
	Write(writer io.Writer)
}

type RuneTester

type RuneTester func(r rune) bool

type TopNStrIntData

type TopNStrIntData []TopNStrIntDatum

func (TopNStrIntData) Len

func (arr TopNStrIntData) Len() int

func (TopNStrIntData) Less

func (arr TopNStrIntData) Less(a, b int) bool

func (TopNStrIntData) Swap

func (arr TopNStrIntData) Swap(a, b int)

type TopNStrIntDatum

type TopNStrIntDatum struct {
	S string
	N int
}

func GetTopNStrInt

func GetTopNStrInt(m map[string]int, n int) []TopNStrIntDatum

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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