morfologik.stemming.NoEncoder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of morfologik-stemming Show documentation
Show all versions of morfologik-stemming Show documentation
Morfologik provides high quality lemmatisation for the Polish language,
along with tools for building and using byte-based finite state automata.
package morfologik.stemming;
import java.nio.ByteBuffer;
/**
* No relative encoding at all (full target form is returned).
*/
public class NoEncoder implements ISequenceEncoder {
@Override
public ByteBuffer encode(ByteBuffer reuse, ByteBuffer source, ByteBuffer target) {
reuse = BufferUtils.clearAndEnsureCapacity(reuse, target.remaining());
target.mark();
reuse.put(target)
.flip();
target.reset();
return reuse;
}
@Override
public ByteBuffer decode(ByteBuffer reuse, ByteBuffer source, ByteBuffer encoded) {
reuse = BufferUtils.clearAndEnsureCapacity(reuse, encoded.remaining());
encoded.mark();
reuse.put(encoded)
.flip();
encoded.reset();
return reuse;
}
@Override
public int prefixBytes() {
return 0;
}
@Override
public String toString() {
return getClass().getSimpleName();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy