小编Aru*_*A K的帖子

在Hadoop Map Reduce中重命名部件文件

我已尝试MultipleOutputs按照http://hadoop.apache.org/docs/mapreduce/r0.21.0/api/index.html?org/apache/hadoop/mapreduce/lib/output/MultipleOutputs中的示例使用该类html的

驱动程序代码

    Configuration conf = new Configuration();
    Job job = new Job(conf, "Wordcount");
    job.setJarByClass(WordCount.class);
    job.setInputFormatClass(TextInputFormat.class);
    job.setMapperClass(WordCountMapper.class);
    job.setReducerClass(WordCountReducer.class);
    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(IntWritable.class);
    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(IntWritable.class);
    FileInputFormat.setInputPaths(job, new Path(args[0]));
    FileOutputFormat.setOutputPath(job, new Path(args[1]));
    MultipleOutputs.addNamedOutput(job, "text", TextOutputFormat.class,
            Text.class, IntWritable.class);
    System.exit(job.waitForCompletion(true) ? 0 : 1);
Run Code Online (Sandbox Code Playgroud)

减速机代码

public class WordCountReducer extends
        Reducer<Text, IntWritable, Text, IntWritable> {
    private IntWritable result = new IntWritable();
    private MultipleOutputs<Text, IntWritable> mos;
    public void setup(Context context){
        mos = new MultipleOutputs<Text, IntWritable>(context);
    }
    public void reduce(Text key, Iterable<IntWritable> values, Context context) …
Run Code Online (Sandbox Code Playgroud)

java hadoop mapreduce

21
推荐指数
2
解决办法
2万
查看次数

使用Stanford NLP训练n-gram NER

最近,我一直在尝试使用Stanford Core NLP训练n-gram实体.我已经按照以下教程 - http://nlp.stanford.edu/software/crf-faq.shtml#b

有了这个,我只能指定unigram令牌及其所属的类.任何人都可以指导我,以便我可以将它扩展到n-gram.我试图从聊天数据集中提取电影名称等已知实体.

如果我错误地解释了斯坦福教程,请指导我,同样可以用于n-gram培训.

我坚持的是以下属性

#structure of your training file; this tells the classifier
#that the word is in column 0 and the correct answer is in
#column 1
map = word=0,answer=1
Run Code Online (Sandbox Code Playgroud)

例如,第一列是单词(unigram),第二列是实体

CHAPTER O
I   O
Emma    PERS
Woodhouse   PERS
Run Code Online (Sandbox Code Playgroud)

现在我需要训练像Hulk,Titanic等已知实体(比如电影名称)作为电影,这种方法很容易.但是如果我需要训练我知道你去年夏天做什么或者宝宝出去什么,最好的办法是什么?

nlp named-entity-recognition stanford-nlp named-entity-extraction opennlp

21
推荐指数
2
解决办法
1万
查看次数

需要数据输入流

有什么区别

FileInputStream fstream = new FileInputStream ("file1.txt");
BufferedReader br = new BufferedReader(new InputStreamReader(fstream));
Run Code Online (Sandbox Code Playgroud)

FileInputStream fstream = new FileInputStream ("file1.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedReader(new InputStreamReader(in));
Run Code Online (Sandbox Code Playgroud)

我们真的需要一个DataInputStream吗?

java datainputstream

6
推荐指数
1
解决办法
3800
查看次数

反向排序归约键

以相反的顺序将Map Output键映射到化简器的最佳方法是什么?默认情况下,Reducer以键的升序接收所有键。任何帮助或意见广受赞赏。

用简单的话来说,在正常情况下,如果映射发出密钥1,4,3,5,2,则reducer会收到与1,2,3,4,5相同的密钥。我希望减速器改为接收5,4,3,2,1

java hadoop mapreduce bigdata

4
推荐指数
2
解决办法
4191
查看次数

排除 Azure Cosmos DB 中的路径

从输入 json 中排除某些键以不被 Azure CosmosDB 索引的正确 JSON 是什么?我们以 mongodb 模式使用 CosmosDB。计划在创建集合后更改 Azure 门户上的索引配置。

示例输入 Json 为

{
    "name": "test",
    "age": 1,
    "location": "l1",
    "height":5.7
}
Run Code Online (Sandbox Code Playgroud)

如果我要在索引中包含姓名和年龄并从索引中删除位置和高度,则includedPaths和exclusionPaths会是什么样子。

azure-cosmosdb

2
推荐指数
1
解决办法
3586
查看次数