use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class NAryChunkExtractor method getNextPair.
@Override
public boolean getNextPair(final ContextPatternWritable pair) {
if (mChunkPairsIter != null && mChunkPairsIter.hasNext()) {
ContextPatternWritable c = mChunkPairsIter.next();
pair.setContext(c.getContext());
pair.setPattern(c.getPattern());
return true;
}
if (mSentIter != null && mSentIter.hasNext()) {
loadChunkPairs();
return getNextPair(pair);
}
return false;
}
use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class ChunkExtractor method getNextPair.
@Override
public boolean getNextPair(final ContextPatternWritable pair) {
if (mChunkPairsIter != null && mChunkPairsIter.hasNext()) {
ContextPatternWritable c = mChunkPairsIter.next();
pair.setContext(c.getContext());
pair.setPattern(c.getPattern());
return true;
}
if (mSentIter != null && mSentIter.hasNext()) {
loadChunkPairs();
return getNextPair(pair);
}
return false;
}
use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class TwitterCooccurExtractor method loadPairs.
private void loadPairs(Text[] terms, String id) {
mPairs.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.setContext(id);
c.setPattern(mPattern);
mPairs.add(c);
}
}
}
use of edu.isi.mavuno.util.ContextPatternWritable in project mavuno by metzlerd.
the class TwitterGeoTemporalExtractor method loadTemporalPairs.
private void loadTemporalPairs(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(calToText());
c.setPattern(mPattern);
mGeoTemporalPairs.add(c);
updateCalendar(-1);
}
// reset calendar
updateCalendar(mLeftTimeWindow);
// context for current time
c = new ContextPatternWritable();
c.setContext(calToText());
c.setPattern(mPattern);
mGeoTemporalPairs.add(c);
// future contexts
for (int rightTime = 1; rightTime <= mRightTimeWindow; rightTime++) {
c = new ContextPatternWritable();
c.setContext(calToText());
c.setPattern(mPattern);
mGeoTemporalPairs.add(c);
updateCalendar(1);
}
// reset calendar
updateCalendar(-mRightTimeWindow);
}
}
}
Aggregations