com.intersystems.iknow.languagemodel.slavic.SerializingMorphologicalAnalyzer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of languagemodel-slavic Show documentation
Show all versions of languagemodel-slavic Show documentation
Slavic Language Model for use with iKnow/iFind
The newest version!
/*-
* $Id: fd8e0656d3b5713b9f653f4e64f481be3825c809 $
*/
package com.intersystems.iknow.languagemodel.slavic;
import java.rmi.RemoteException;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
/**
* @author Andrey Shcheglov (mailto:[email protected])
*/
public final class SerializingMorphologicalAnalyzer {
private static final Gson GSON = new GsonBuilder()
.registerTypeAdapter(MorphologicalAnalysisResult.class, new MorphologicalAnalysisResultSerializer())
.setPrettyPrinting()
.create();
private final MorphologicalAnalyzer delegate;
/**
* @param delegate
*/
public SerializingMorphologicalAnalyzer(final MorphologicalAnalyzer delegate) {
this.delegate = delegate;
}
/**
* @param text
* @throws AnalysisException
* @throws RemoteException
* @see MorphologicalAnalyzer#analyze(String)
*/
public String analyze(final String text)
throws AnalysisException, RemoteException {
return GSON.toJson(this.delegate.analyze(text));
}
}