diff options
author | Tony Mak <tonymak@google.com> | 2020-08-24 22:45:06 +0100 |
---|---|---|
committer | Tony Mak <tonymak@google.com> | 2020-08-28 13:25:43 +0000 |
commit | c96c078aa334da1d05669f6b302ba34448e7f265 (patch) | |
tree | 64778505f65e80df8d0fd3822d2788c2c594d5bc /jni | |
parent | 9a298490f2f573b079901ae0e49617ce40250231 (diff) | |
download | libtextclassifier-c96c078aa334da1d05669f6b302ba34448e7f265.tar.gz |
Export libtextclassifier
Test: atest -pexternal/libtextclassifier/TEST_MAPPING
Change-Id: I74dd0445ce0ff655933497060b4ce46ee56543c5
Diffstat (limited to 'jni')
-rw-r--r-- | jni/com/google/android/textclassifier/AnnotatorModel.java | 37 |
1 files changed, 33 insertions, 4 deletions
diff --git a/jni/com/google/android/textclassifier/AnnotatorModel.java b/jni/com/google/android/textclassifier/AnnotatorModel.java index a116f0a..d2001ed 100644 --- a/jni/com/google/android/textclassifier/AnnotatorModel.java +++ b/jni/com/google/android/textclassifier/AnnotatorModel.java @@ -711,6 +711,7 @@ public final class AnnotatorModel implements AutoCloseable { private final float userLocationAccuracyMeters; private final String userFamiliarLanguageTags; private final boolean usePodNer; + private final boolean triggerDictionaryOnBeginnerWords; private ClassificationOptions( long referenceTimeMsUtc, @@ -722,7 +723,8 @@ public final class AnnotatorModel implements AutoCloseable { double userLocationLng, float userLocationAccuracyMeters, String userFamiliarLanguageTags, - boolean usePodNer) { + boolean usePodNer, + boolean triggerDictionaryOnBeginnerWords) { this.referenceTimeMsUtc = referenceTimeMsUtc; this.referenceTimezone = referenceTimezone; this.locales = locales; @@ -733,6 +735,7 @@ public final class AnnotatorModel implements AutoCloseable { this.userLocationAccuracyMeters = userLocationAccuracyMeters; this.userFamiliarLanguageTags = userFamiliarLanguageTags; this.usePodNer = usePodNer; + this.triggerDictionaryOnBeginnerWords = triggerDictionaryOnBeginnerWords; } /** Can be used to build a ClassificationOptions instance. */ @@ -747,6 +750,7 @@ public final class AnnotatorModel implements AutoCloseable { private float userLocationAccuracyMeters = INVALID_LOCATION_ACCURACY_METERS; private String userFamiliarLanguageTags = ""; private boolean usePodNer = true; + private boolean triggerDictionaryOnBeginnerWords = false; public Builder setReferenceTimeMsUtc(long referenceTimeMsUtc) { this.referenceTimeMsUtc = referenceTimeMsUtc; @@ -798,6 +802,12 @@ public final class AnnotatorModel implements AutoCloseable { return this; } + public Builder setTrigerringDictionaryOnBeginnerWords( + boolean triggerDictionaryOnBeginnerWords) { + this.triggerDictionaryOnBeginnerWords = triggerDictionaryOnBeginnerWords; + return this; + } + public ClassificationOptions build() { return new ClassificationOptions( referenceTimeMsUtc, @@ -809,7 +819,8 @@ public final class AnnotatorModel implements AutoCloseable { userLocationLng, userLocationAccuracyMeters, userFamiliarLanguageTags, - usePodNer); + usePodNer, + triggerDictionaryOnBeginnerWords); } } @@ -859,6 +870,10 @@ public final class AnnotatorModel implements AutoCloseable { public boolean getUsePodNer() { return usePodNer; } + + public boolean getTriggerDictionaryOnBeginnerWords() { + return triggerDictionaryOnBeginnerWords; + } } /** Represents options for the annotate call. */ @@ -877,6 +892,7 @@ public final class AnnotatorModel implements AutoCloseable { private final double userLocationLng; private final float userLocationAccuracyMeters; private final boolean usePodNer; + private final boolean triggerDictionaryOnBeginnerWords; private AnnotationOptions( long referenceTimeMsUtc, @@ -892,7 +908,8 @@ public final class AnnotatorModel implements AutoCloseable { double userLocationLat, double userLocationLng, float userLocationAccuracyMeters, - boolean usePodNer) { + boolean usePodNer, + boolean triggerDictionaryOnBeginnerWords) { this.referenceTimeMsUtc = referenceTimeMsUtc; this.referenceTimezone = referenceTimezone; this.locales = locales; @@ -907,6 +924,7 @@ public final class AnnotatorModel implements AutoCloseable { this.hasLocationPermission = hasLocationPermission; this.hasPersonalizationPermission = hasPersonalizationPermission; this.usePodNer = usePodNer; + this.triggerDictionaryOnBeginnerWords = triggerDictionaryOnBeginnerWords; } /** Can be used to build an AnnotationOptions instance. */ @@ -925,6 +943,7 @@ public final class AnnotatorModel implements AutoCloseable { private double userLocationLng = INVALID_LONGITUDE; private float userLocationAccuracyMeters = INVALID_LOCATION_ACCURACY_METERS; private boolean usePodNer = true; + private boolean triggerDictionaryOnBeginnerWords = false; public Builder setReferenceTimeMsUtc(long referenceTimeMsUtc) { this.referenceTimeMsUtc = referenceTimeMsUtc; @@ -996,6 +1015,11 @@ public final class AnnotatorModel implements AutoCloseable { return this; } + public Builder setTriggerDictionaryOnBeginnerWords(boolean triggerDictionaryOnBeginnerWords) { + this.triggerDictionaryOnBeginnerWords = triggerDictionaryOnBeginnerWords; + return this; + } + public AnnotationOptions build() { return new AnnotationOptions( referenceTimeMsUtc, @@ -1011,7 +1035,8 @@ public final class AnnotatorModel implements AutoCloseable { userLocationLat, userLocationLng, userLocationAccuracyMeters, - usePodNer); + usePodNer, + triggerDictionaryOnBeginnerWords); } } @@ -1077,6 +1102,10 @@ public final class AnnotatorModel implements AutoCloseable { public boolean getUsePodNer() { return usePodNer; } + + public boolean getTriggerDictionaryOnBeginnerWords() { + return triggerDictionaryOnBeginnerWords; + } } /** |