List of usage examples for org.apache.hadoop.io IntWritable get
public int get()
From source file:de.kp.core.spade.hadoop.IDListWritable.java
License:Open Source License
public IDList get() { Map<Integer, BitSet> seqItemsetEntries = new HashMap<Integer, BitSet>(); for (Map.Entry<Writable, Writable> entry : mapWritable.entrySet()) { IntWritable k = (IntWritable) entry.getKey(); BitSetWritable v = (BitSetWritable) entry.getValue(); seqItemsetEntries.put(k.get(), v.get()); }// ww w . ja va 2s .c o m return new IDListBitmap(seqItemsetEntries); }
From source file:de.tudarmstadt.ukp.dkpro.c4corpus.hadoop.deduplication.DocumentInfo.java
License:Apache License
public void setDocLength(IntWritable docLength) { this.docLength = new IntWritable(docLength.get()); }
From source file:de.tudarmstadt.ukp.dkpro.c4corpus.hadoop.full.CompositeKey.java
License:Apache License
public void setSourceIndex(IntWritable index) { this.sourceIndex = new IntWritable(index.get()); }
From source file:dgCombIndexer.DgCombCombiner.java
License:Open Source License
@Override public void reduce(Text term, Iterable<IntWritable> docIds, Context context) throws IOException, InterruptedException { PostingList postingList = new PostingList(); for (IntWritable docId : docIds) { postingList.addPosting(docId.get()); }/* w w w .j a v a 2 s. co m*/ //String posting = postingList.toStringDE(); context.write(new Text(term), postingList); }
From source file:dgIndexer.DgReduce.java
License:Open Source License
@Override public void reduce(Text term, Iterable<IntWritable> docIds, Context context) throws IOException, InterruptedException { PostingList postingList = new PostingList(); for (IntWritable docId : docIds) { postingList.addPosting(docId.get()); }/*from www. j ava2 s . c o m*/ String posting = postingList.toStringDE(); context.write(new Text(term), new Text(posting)); }
From source file:dz.lab.mapred.hbase.custom_output.StartsWithCountReducer_HBase.java
@Override protected void reduce(Text key, Iterable<IntWritable> counts, Context context) throws IOException, InterruptedException { int sum = 0;/*ww w.jav a 2s. c om*/ for (IntWritable count : counts) { sum += count.get(); } // reducer must output either Put or Delete object Put put = new Put(key.copyBytes()); put.add(toBytes(FAMILY), toBytes(RESULT_COLUMN), toBytes(Integer.toString(sum))); context.write(null, put); }
From source file:dz.lab.mapred.StartsWithCountReducer.java
@Override protected void reduce(Text token, Iterable<IntWritable> counts, Context context) throws IOException, InterruptedException { int sum = 0;/*from ww w.j av a 2 s . c om*/ for (IntWritable count : counts) { sum += count.get(); } context.write(token, new IntWritable(sum)); }
From source file:edu.indiana.d2i.htrc.io.index.Dictionary.java
License:Apache License
public Dictionary(Configuration conf) throws IOException { // String dicionaryPath = conf.get(HTRCConstants.DICTIONARY_PATH); String dicionaryPath = conf.get("htrc.solr.dictionary"); // System.out.println("!!!dicionaryPath " + dicionaryPath); SequenceFile.Reader reader = new SequenceFile.Reader(FileSystem.get(conf), new Path(dicionaryPath), conf); Text key = new Text(); IntWritable value = new IntWritable(); while (reader.next(key, value)) { dictionary.put(key.toString(), value.get()); }// w w w. j av a 2 s . c o m reader.close(); }
From source file:edu.ub.ahstfg.io.document.ParsedDocument.java
License:Open Source License
/** * Adds a new term. If the term exists increases their frequency. * @param term Term to add./*w w w.java2 s . c o m*/ */ public void addTerm(Text term) { if (terms.containsKey(term)) { IntWritable n = (IntWritable) terms.get(term); n.set(n.get() + 1); } else { terms.put(term, ONE()); } }
From source file:edu.ub.ahstfg.io.document.ParsedDocument.java
License:Open Source License
/** * Gets the HashMap containing term frequency. * @return Term frequency HashMap.//from ww w. j av a 2 s.com */ public HashMap<String, Short> getTermMap() { HashMap<String, Short> ret = new HashMap<String, Short>(); Text t; IntWritable value; for (Writable w : terms.keySet()) { t = (Text) w; value = (IntWritable) terms.get(w); ret.put(t.toString(), (short) value.get()); } return ret; }