Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make some classes serializable #100

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/main/java/com/optimaize/langdetect/LanguageDetector.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.google.common.base.Optional;
import com.optimaize.langdetect.i18n.LdLocale;

import java.io.Serializable;
import java.util.List;

/**
Expand All @@ -34,7 +35,7 @@
*
* @author Fabian Kessler
*/
public interface LanguageDetector {
public interface LanguageDetector extends Serializable {

/**
* Returns the best detected language if the algorithm is very confident.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.Serializable;
import java.util.*;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.Serializable;
import java.util.*;

/**
Expand All @@ -33,7 +34,7 @@
*
* @author Fabian Kessler
*/
public final class NgramFrequencyData {
public final class NgramFrequencyData implements Serializable {

/**
* Key = ngram
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/optimaize/langdetect/i18n/LdLocale.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import com.google.common.base.Splitter;
import org.jetbrains.annotations.NotNull;

import java.io.Serializable;
import java.util.List;

/**
Expand Down Expand Up @@ -63,7 +64,7 @@
*
* @author fabian kessler
*/
public final class LdLocale {
public final class LdLocale implements Serializable {

@NotNull
private final String language;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.Serializable;
import java.util.*;

/**
Expand All @@ -29,7 +30,7 @@
*
* @author Fabian Kessler
*/
public class NgramExtractor {
public class NgramExtractor implements Serializable {

@NotNull
private final List<Integer> gramLengths;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

package com.optimaize.langdetect.ngram;

import java.io.Serializable;

/**
* Filters out some undesired n-grams.
*
* Implementations must be immutable.
*
* @author Fabian Kessler
*/
public interface NgramFilter {
public interface NgramFilter extends Serializable {

boolean use(String ngram);

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/com/optimaize/langdetect/text/TextFilter.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@

package com.optimaize.langdetect.text;

import java.io.Serializable;

/**
* Allows to filter content from a text to be ignored for the n-gram analysis.
*
* <p>Implementations must be immutable and stateless.</p>
*
* @author Fabian Kessler
*/
public interface TextFilter {
public interface TextFilter extends Serializable {

String filter(CharSequence text);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@

package com.optimaize.langdetect.text;

import java.io.Serializable;

/**
* Factory for {@link TextObject}s.
*
* @author Fabian Kessler
*/
public class TextObjectFactory {
public class TextObjectFactory implements Serializable {

private final TextFilter textFilter;
private final int maxTextLength;
Expand Down