【求教】如何才能得到单词的偏移量?

78 visualizações
Pular para a primeira mensagem não lida

张华祥

não lida,
20 de jul. de 2014, 04:17:3220/07/2014
para cs40...@googlegroups.com
RT

郭行健

não lida,
20 de jul. de 2014, 04:56:4920/07/2014
para cs40...@googlegroups.com
在默认的TextInpuFormat中,Mapper的key(类型是LongWritable)存储的便是这一行的偏移量。单词的偏移量可以在此基础上一个字节一个字节地数……虽然我觉得有行偏移量就足够了。

在 2014年7月20日星期日UTC+8下午4时17分32秒,张华祥写道:
RT

杨博文

não lida,
20 de jul. de 2014, 07:53:5620/07/2014
para cs40...@googlegroups.com
默认情况下的FileInputFormat是TextInputFormat,可以看做是FileInputFormat<LongWritable,Text>
其中默认情况下LongWritable是该行相对文件的偏移量,Text是这一行的内容。
map(Object key,Text value,Context context)里的key.toString()就是了。
在 2014年7月20日星期日UTC+8下午4时17分32秒,zinc写道:
RT

Haoyan Huo

não lida,
20 de jul. de 2014, 21:26:4920/07/2014
para cs40...@googlegroups.com
 java.util.regex.Matcher.start() 正是做这个的

On Sunday, July 20, 2014 4:17:32 PM UTC+8, zinc wrote:
RT

zinc

não lida,
21 de jul. de 2014, 05:23:0721/07/2014
para cs40...@googlegroups.com
真心有用

在 2014年7月20日星期日UTC-7下午6时26分49秒,Haoyan Huo写道:
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem