Exemple #1
0
func (this *AmfWorker) Map(line string, out chan<- mr.KeyValue) {
	req := new(amfRequest)
	req.parseLine(line)

	kv := mr.NewKeyValue()
	key := mr.NewKey(req.class, req.method, req.uri)
	kv[key] = 1

	kv.Emit(out)
}
Exemple #2
0
func (this *UniWorker) Map(line string, out chan<- mr.KeyValue) {
	line = line[:len(line)-1]
	line = strings.Replace(line, "+", " ", 2)
	kv := mr.NewKeyValue()
	rs := re.ReplaceAll([]byte(line), []byte{})
	line = string(rs)
	line = trimAllRune(line, []rune{'>', '~', ';', '.', '-', '*'})
	words := strings.Split(line, " ")
	for _, w := range words {
		line = strings.Trim(line, "  ")
		k := mr.NewKey(w)
		kv[k] = 1
	}

	kv.Emit(out)
}
Exemple #3
0
// Extract meta info related to amf from a valid line
func (this *FileWorker) Map(line string, out chan<- mr.KeyValue) {
	kv := mr.NewKeyValue()
	line = trimAllRune(line, []rune{'=', ':', '+', '.', '-'})
	line = strings.Trim(line, "  ")
	if len(line) == 0 {
		return
	}

	terms := strings.Split(line, " ")
	for i, term := range terms {
		for j := i + 1; j < len(terms); j++ {
			coOccurence := mr.NewKey(strings.TrimSpace(term), strings.TrimSpace(terms[j]))
			kv[coOccurence] = 1

		}

	}

	kv.Emit(out)
}