Documentation ¶
Overview ¶
Package main contains all the things. affixes.go handles affix parsing of input.
Package main contains all the things ¶
Package main contains all the things. lib.go handles common functions.
Package fwew_lib contains all the things. numbers.go contains all the stuff for the number parsing
Package main contains all the things. txt.go handles program strings.
Package fwew_lib contains all the things. version.go handles program version.
Package fwew_lib contains all the things. word.go is home to the Word struct.
Index ¶
- Constants
- Variables
- func AlphabetizeHelper(a string, b string) bool
- func ArrCount(s []string, q string) int
- func AssignWord(wordmap map[string][]string, natlangWords string, naviWord string) (result map[string][]string)
- func AssureDict() error
- func BidirectionalSearch(searchNaviWords string, checkFixes bool, langCode string) (results [][]Word, err error)
- func CacheDict() error
- func CacheDictHash() error
- func CacheDictHash2() error
- func CacheDictHash2Orig(mysql bool) error
- func CacheDictHashOrig(mysql bool) error
- func Contains(s []string, q []string) bool
- func ContainsStr(s []string, q string) bool
- func DeleteElement(s []string, q string) []string
- func DeleteEmpty(s []string) []string
- func DownloadDict(filepath string) error
- func FindDictionaryFile() string
- func FullNames(ending string, name_count int, dialect int, syllable_count [3]int, ...) (output string)
- func GetDictSize(lang string) (count string, err error)
- func GetDictSizeSimple() (count int)
- func GetHomonyms() (results [][]Word, err error)
- func GetLenitionTable() [][2]string
- func GetMultiIPA() (results [][]Word, err error)
- func GetMultiwordWords() map[string][][]string
- func GetOddballs() (results [][]Word, err error)
- func GetOtherThats() [][3]string
- func GetPhonemeDistrosMap(lang string) (allDistros [][][]string)
- func GetShortLenitionTable() [][2]string
- func GetThatTable() [][5]string
- func Glob(pattern, subj string) bool
- func HasPrefixStrArr(s string, q []string) bool
- func Index(s []string, q string) int
- func IndexStr(s string, q rune) int
- func IsLetter(s string) bool
- func IsValidNavi(word string, lang string, two_thousand_limit bool) string
- func IsValidNaviHelper(word string, lang string) string
- func MakeSyllableBreakdown(syllables []string) string
- func NameAlu(name_count int, dialect int, syllable_count int, noun_mode int, adj_mode int) (output string)
- func NaviToNumber(input string) (int, error)
- func NoDoubleDiphthongs(syllable_breakdown string) string
- func NumberToNavi(input int) (string, error)
- func PhonemeDistros()
- func ReefMe(ipa string, inter bool) []string
- func Reverse(s string) string
- func RomanizeSecondIPA(IPA string) string
- func RunOnDict(f func(word Word) error) (err error)
- func SHA1Hash(filename string) string
- func SearchTerms(input string) []string
- func SingleNames(name_count int, dialect int, syllable_count int) (output string)
- func SortedWords() (nouns []Word, adjectives []Word, verbs []Word, transitiveVerbs []Word)
- func StartEverything() string
- func StripChars(str, chr string) string
- func Text(s string) string
- func TranslateFromNaviHash(searchNaviWords string, checkFixes bool) (results [][]Word, err error)
- func TranslateFromNaviHashHelper(start int, allWords []string, checkFixes bool) (steps int, results [][]Word, err error)
- func TranslateToNaviHash(searchWord string, langCode string) (results [][]Word)
- func UncacheDict()
- func UncacheHashDict()
- func UncacheHashDict2()
- func UpdateDict() error
- type ConjugationCandidate
- type MetaDict
- type PhonemeTuple
- type Tuples
- type Word
- func AppendAndAlphabetize(words []Word, word Word) []Word
- func AppendToFront(words []Word, input Word) []Word
- func EnglishIfNull(word Word) Word
- func GetFullDict() (allWords []Word, err error)
- func IsVerb(input string, comparator string) (result bool, affixes Word)
- func List(args []string, checkDigraphs uint8) (results []Word, err error)
- func Random(amount int, args []string, checkDigraphs uint8) (results []Word, err error)
- func SearchNatlangWord(wordmap map[string][]string, searchWord string) (results []Word)
- func TestDeconjugations(searchNaviWord string) (results []Word)
- func TranslateToNaviHashHelper(searchWord string, langCode string) (results []Word)
Constants ¶
const ( // cache DictionaryNotFound = constError("no dictionary found") // numbers NegativeNumber = constError("negative numbers not allowed") NumberTooBig = constError("number too big") NoTranslationFound = constError("no translation found") // list InvalidNumber = constError("invalidNumericError") NoResults = constError("noResultsError") )
Errors raised by package x.
const GLOB = "%"
GLOB https://github.com/ryanuber/go-glob The character which is treated like a glob
Variables ¶
var Version = version{
5, 22, 2,
"",
"Kanua Kenten",
"",
}
Version is a printable version struct containing program version information
Functions ¶
func AlphabetizeHelper ¶
func AssignWord ¶
func AssignWord(wordmap map[string][]string, natlangWords string, naviWord string) (result map[string][]string)
Helper function for CacheDictHash2
func AssureDict ¶
func AssureDict() error
AssureDict will assure, that the dictionary exists. If no dictionary is found, it will be downloaded next of the executable.
func BidirectionalSearch ¶
func BidirectionalSearch(searchNaviWords string, checkFixes bool, langCode string) (results [][]Word, err error)
Translate some text. The language context is with Eywa now :ipu: !! Multiple words are supported !! This will return a 2D array of Words, that fit the input text One Word can have multiple meanings and words (e.g. synonyms)
func CacheDictHash ¶
func CacheDictHash() error
func CacheDictHash2Orig ¶ added in v5.16.0
func CacheDictHashOrig ¶ added in v5.16.0
This will cache the whole dictionary (Na'vi to natural language). Please call this, if you want to translate multiple words or running infinitely (e.g. CLI-go-prompt, discord-bot)
func ContainsStr ¶
ContainsStr returns true if q is in s
func DeleteElement ¶
DeleteElement "deletes" all occurrences of q in s actually returns a new string slice containing the original minus all q
func DeleteEmpty ¶
DeleteEmpty "deletes" all empty string entries in s actually returns a new string slice containing all non-empty strings in s
func DownloadDict ¶
DownloadDict downloads the latest released version of the dictionary file and saves it to the given filepath. You can give an empty string as filepath param, to update the found dictionary file.
func FindDictionaryFile ¶
func FindDictionaryFile() string
the dictionary file can be places into: - <workingDir>/dictionary.txt - <workingDir>/.fwew/dictionary.txt - <homeDir>/.fwew/dictionary.txt
func GetDictSize ¶
Return a complete sentence
func GetHomonyms ¶
Get all words with multiple definitions
func GetLenitionTable ¶
func GetLenitionTable() [][2]string
func GetMultiIPA ¶ added in v5.11.7
Get all words with multiple definitions
func GetOddballs ¶ added in v5.13.0
Get all words with non-standard phonotactics
func GetOtherThats ¶
func GetOtherThats() [][3]string
func GetPhonemeDistrosMap ¶
func GetShortLenitionTable ¶
func GetShortLenitionTable() [][2]string
func GetThatTable ¶
func GetThatTable() [][5]string
func Glob ¶
Glob will test a string pattern, potentially containing globs, against a subject string. The result is a simple true/false, determining whether or not the glob pattern matched the subject text.
func HasPrefixStrArr ¶
ContainsStrArr returns true if anything in q is in s
func IsValidNavi ¶ added in v5.13.0
func IsValidNaviHelper ¶ added in v5.13.0
See if a word is phonotactically valid in Na'vi
func MakeSyllableBreakdown ¶ added in v5.18.0
func NaviToNumber ¶
Translate a Na'vi number word to the actual integer. Na'vi numbers are octal values, so the integer is defined as octal number, and can easily be displayed as decimal number. If no translation is found, `NoTranslationFound` is returned as error!
func NoDoubleDiphthongs ¶ added in v5.18.0
Turns things like maw-ey into ma-wey, so the checker knows mawll is valid as ma-wll and not mistaken for maw-ll (invalid)
func NumberToNavi ¶
Translate an octal-integer into the Na'vi number word.
func PhonemeDistros ¶
func PhonemeDistros()
Called on startup to feed and compile dictionary information into the name generator
func RomanizeSecondIPA ¶ added in v5.11.7
Helper function to get phonetic transcriptions of secondary pronunciations Only multiple IPA words will call this function
func RunOnDict ¶
This will run the function `f` inside the cache or the file directly. Use this to get words out of the dictionary function `f` is called on every single line in the dictionary!
func SearchTerms ¶ added in v5.11.3
Turn a definition into its searchable terms
func SingleNames ¶
* Name generators
func SortedWords ¶
Helper function for name-alu
func StartEverything ¶
func StartEverything() string
func StripChars ¶
StripChars strips all the characters in chr out of str
func TranslateFromNaviHash ¶
Translate some navi text. !! Multiple words are supported !! This will return a 2D array of Words that fit the input text The first word will only contain the query put into the translate command One Navi-Word can have multiple meanings and words (e.g. synonyms)
func TranslateToNaviHash ¶
func UncacheDict ¶ added in v5.16.0
func UncacheDict()
func UncacheHashDict ¶
func UncacheHashDict()
func UncacheHashDict2 ¶
func UncacheHashDict2()
func UpdateDict ¶
func UpdateDict() error
Update the dictionary.txt. universalLock will hopefully prevent anything from accessing the dict while updating
Types ¶
type ConjugationCandidate ¶
type ConjugationCandidate struct {
// contains filtered or unexported fields
}
type MetaDict ¶
type MetaDict struct { EN map[string][]string DE map[string][]string ES map[string][]string ET map[string][]string FR map[string][]string HU map[string][]string KO map[string][]string NL map[string][]string PL map[string][]string PT map[string][]string RU map[string][]string SV map[string][]string TR map[string][]string UK map[string][]string }
type PhonemeTuple ¶ added in v5.15.0
type PhonemeTuple struct {
// contains filtered or unexported fields
}
type Tuples ¶ added in v5.15.0
type Tuples []PhonemeTuple
type Word ¶
type Word struct { ID string IPA string InfixLocations string PartOfSpeech string Source string Stressed string Syllables string InfixDots string DE string EN string ES string ET string FR string HU string KO string NL string PL string PT string RU string SV string TR string UK string Affixes affix }
Word is a struct that contains all the data about a given word
func AppendAndAlphabetize ¶
func AppendToFront ¶
Helper for TranslateFromNaviHashHelper
func EnglishIfNull ¶ added in v5.11.2
If a definition is not available in a certain language, default to English
func GetFullDict ¶
func List ¶
List filters the dictionary based on the args. args can be empty, if so, the whole Dict will be returned (This also happens if < 3 args are given) It will try to always get 3 args and an `and` in between. If less than 3 exist, than it will wil return the previous results.
func Random ¶
Get random words out of the dictionary. If args are applied, the dict will be filtered for args before random words are chosen. args will be put into the `List()` algorithm.
func SearchNatlangWord ¶
func TestDeconjugations ¶
func (*Word) CloneWordStruct ¶
CloneWordStruct is basically a copy constructor for Word struct Basically not needed, cause go copies things by itself. Only string arrays in Affixes are pointers and therefore need manual copy.