use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class TwitterCooccurExtractor method getNextPair.
/* (non-Javadoc)
* @see edu.isi.mavuno.extract.Extractor#getNextPair(edu.isi.mavuno.util.ContextPatternWritable)
*/
@Override
public boolean getNextPair(ContextPatternWritable pair) {
if (mPairsIter != null && mPairsIter.hasNext()) {
ContextPatternWritable c = mPairsIter.next();
pair.setContext(c.getContext());
pair.setPattern(c.getPattern());
return true;
}
return false;
}
use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class TwitterGeoTemporalExtractor method getNextPair.
/* (non-Javadoc)
* @see edu.isi.mavuno.extract.Extractor#getNextPair(edu.isi.mavuno.util.ContextPatternWritable)
*/
@Override
public boolean getNextPair(ContextPatternWritable pair) {
if (mGeoTemporalPairsIter != null && mGeoTemporalPairsIter.hasNext()) {
ContextPatternWritable c = mGeoTemporalPairsIter.next();
pair.setContext(c.getContext());
pair.setPattern(c.getPattern());
return true;
}
return false;
}
use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class TwitterGeoTemporalExtractor method loadGeoTemporalPairs.
private void loadGeoTemporalPairs(Text[] terms) {
mGeoTemporalPairs.clear();
ContextPatternWritable c;
for (int i = 0; i < terms.length; i++) {
for (int gramSize = 1; gramSize <= mMaxGramSize; gramSize++) {
if (!getPattern(mPattern, terms, i, gramSize)) {
continue;
}
// past contexts
for (int leftTime = 1; leftTime <= mLeftTimeWindow; leftTime++) {
c = new ContextPatternWritable();
c.setContext(MavunoUtils.createContext(calToText(), mLocation));
c.setPattern(mPattern);
mGeoTemporalPairs.add(c);
updateCalendar(-1);
}
// reset calendar
updateCalendar(mLeftTimeWindow);
// context for current time
c = new ContextPatternWritable();
c.setContext(MavunoUtils.createContext(calToText(), mLocation));
c.setPattern(mPattern);
mGeoTemporalPairs.add(c);
// future contexts
for (int rightTime = 1; rightTime <= mRightTimeWindow; rightTime++) {
c = new ContextPatternWritable();
c.setContext(MavunoUtils.createContext(calToText(), mLocation));
c.setPattern(mPattern);
mGeoTemporalPairs.add(c);
updateCalendar(1);
}
// reset calendar
updateCalendar(-mRightTimeWindow);
}
}
}
use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class TwitterGeoTemporalExtractor method loadGeoPairs.
private void loadGeoPairs(Text[] terms) {
mGeoTemporalPairs.clear();
ContextPatternWritable c;
for (int i = 0; i < terms.length; i++) {
for (int gramSize = 1; gramSize <= mMaxGramSize; gramSize++) {
if (!getPattern(mPattern, terms, i, gramSize)) {
continue;
}
c = new ContextPatternWritable();
c.setPattern(mPattern);
c.setContext(mLocation);
mGeoTemporalPairs.add(c);
}
}
}
use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class DIRTExtractor method getNextPair.
@Override
public boolean getNextPair(ContextPatternWritable pair) {
if (mDependPairsIter != null && mDependPairsIter.hasNext()) {
ContextPatternWritable c = mDependPairsIter.next();
pair.setContext(c.getContext());
pair.setPattern(c.getPattern());
return true;
}
if (mSentIter != null && mSentIter.hasNext()) {
loadDependPairs();
return getNextPair(pair);
}
return false;
}
Aggregations