func (nn *MorfE) InitEngl() { nn.Graf.Init() nn.Unions = make(map[string]map[string]string, 0) frub.Decode(&nn.Unions, "file/englishLemm/noFounf") nn.frequence = make(map[string]int, 0) frub.GetByZn(&nn.frequence, "file/englishLemm/frequence1.gob") nn.fraz = make(map[string][][]string) frub.Decode(&nn.fraz, "file/englishLemm/fraz") nn.expVerb = make(map[string][]string, 0) frub.GetByZn(&nn.expVerb, "file/englishLemm/findverb1.gob") nn.expVerb1 = make(map[string]string, 0) frub.GetByZn(&nn.expVerb, "file/englishLemm/findverb.gob") nn.expAdj = make(map[string][]string, 0) frub.GetByZn(&nn.expAdj, "file/englishLemm/findadj1.gob") nn.expNoun = make(map[string]string, 0) frub.Decode(&nn.expNoun, "file/englishLemm/findnoun") nn.Verb = make(map[string]string, 0) frub.Decode(&nn.Verb, "file/englishLemm/verb") nn.Noun = make(map[string]string, 0) frub.Decode(&nn.Noun, "file/englishLemm/noun") nn.Adj = make(map[string]string, 0) frub.Decode(&nn.Adj, "file/englishLemm/adj") nn.Adv = make(map[string]string, 0) frub.Decode(&nn.Adv, "file/englishLemm/adv") nn.rubbx = frub.NewRubAr() }
func createFrequency() { i := 0 frequence := make(map[string]int, 0) baseFrequence := [][]string{} frub.Decode(&baseFrequence, "file/englishLemm/baseFrequence") for _, v := range baseFrequence { i++ var arrayType [][]string for _, v1 := range v { s := []string{} //for _, v1 := range v { s = append(s, v1) //} arrayType = append(arrayType, s) } first := []string{"^"} next := []string{} for k, v := range arrayType { if k == len(arrayType)-1 { next = []string{"$"} } else { next = arrayType[k+1] } for _, v1 := range first { for _, v2 := range v { for _, v3 := range next { if _, found := frequence[v1+v2+v3]; found { frequence[v1+v2+v3] = frequence[v1+v2+v3] + 1 } else { frequence[v1+v2+v3] = 1 } } } } first = v } if i%10000 == 0 { fmt.Println(i) } if i > 10000 { //break } } frub.CreateByZn(frequence, "file/englishLemm/frequence1.gob") wodfFile, _ := os.Create("file/englishLemm/frequence1") frub.Encode(frequence, wodfFile) //otv := rankByWordCount(frequence) for k, v := range frequence { fmt.Println(k, " - ", v) } }