0
Google 도서의 ngrams에 대한 mapreduce 작업을 구축하려고합니다. 내 매퍼는 로컬에서 테스트 할 때 잘 작동하지만 감속기는 값을 반환하지 않습니다. 감속기는 뭔가 다음과 같다 :파이썬 ngram 감속기가 출력을 반환하지 않습니까?
#! /usr/bin/env python
import sys
current_word = ''
word_in_progress = ''
target_year_count = 0
prior_year_count = 0
target_year = 1999
for line in sys.stdin:
line = line.strip().split('\t')
if len(line) !=3:
continue
current_word, year, occurances = line
if current_word != word_in_progress:
if target_year_count > 0:
if prior_year_count ==0:
print '%s\t%s' % (word_in_progress, target_year_count)
try:
year = int(year)
except ValueError:
continue
try:
occurances = int(occurances)
except ValueError:
continue
if year == target_year:
target_year_count += occurances
if year < target_year:
prior_year_count += occurances
print '%s\t%s' % (word_in_progress, target_year_count)
if target_year_count > 0:
if prior_year_count ==0:
print '%s\t%s' % (word_in_progress, target_year_count)
내가 우분투 명령 줄에서 다음 명령을 입력 할 때 :
[email protected]:~/hadoop$ cat /home/hduser/Documents/test1.1.txt | /home/hduser /hadoop/mapper-ngram.py | sort -k1,1 | /home/hduser/hadoop/reducerngram1.py| sort -k2,2n
을 나는 아무것도 얻을 수 없다. 누군가 내가하고있는 잘못을 말해 줄 수 있습니까? 내가 확인할 것