Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
PR feedback: tighten NLU class access
Browse files Browse the repository at this point in the history
  • Loading branch information
space-pope committed Feb 28, 2020
1 parent 417c38f commit 86b0444
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* A simple data class that represents both the text of tokens produced from a
* full string and identifiers associated with those tokens.
*/
public class EncodedTokens {
final class EncodedTokens {

private final List<String> originalTokens;
private final List<Integer> ids;
Expand All @@ -19,7 +19,7 @@ public class EncodedTokens {
*
* @param spaceSeparated The original string split on whitespace.
*/
public EncodedTokens(String[] spaceSeparated) {
EncodedTokens(String[] spaceSeparated) {
this.ids = new ArrayList<>();
this.originalTokens = Arrays.asList(spaceSeparated);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* An internal class to contain the business logic for turning raw model outputs
* into usable intents/slots.
*/
class TFNLUOutput {
final class TFNLUOutput {

TFNLUOutput() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* produce the same results on CJK input as other Wordpiece tokenizers.
* </p>
*/
public class WordpieceTextEncoder implements TextEncoder {
final class WordpieceTextEncoder implements TextEncoder {
private static final String UNKNOWN = "[UNK]";
private static final String SUFFIX_MARKER = "##";

Expand All @@ -41,7 +41,7 @@ public class WordpieceTextEncoder implements TextEncoder {
* resource file.
* @param nluContext Context used to surface loading errors.
*/
public WordpieceTextEncoder(SpeechConfig config, NLUContext nluContext) {
WordpieceTextEncoder(SpeechConfig config, NLUContext nluContext) {
this(config, nluContext, Thread::new);
}

Expand All @@ -55,7 +55,7 @@ public WordpieceTextEncoder(SpeechConfig config, NLUContext nluContext) {
* @param threadFactory Thread factory used for creating a resource loading
* thread.
*/
public WordpieceTextEncoder(SpeechConfig config, NLUContext nluContext,
WordpieceTextEncoder(SpeechConfig config, NLUContext nluContext,
ThreadFactory threadFactory) {
String vocabFile = config.getString("wordpiece-vocab-path");
this.context = nluContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
* multi-digit requirements (telephone numbers, social security numbers, etc.)
* </p>
*/
public class DigitsParser implements SlotParser {
public final class DigitsParser implements SlotParser {
private static final Map<String, Integer> ENG_ZERO = new HashMap<>();
private static final Map<String, Integer> ENG_MOD10 = new HashMap<>();
private static final Map<String, Integer> ENG_MOD20 = new HashMap<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/**
* A parser that does not alter string slot values recognized by the model.
*/
public class IdentityParser implements SlotParser {
public final class IdentityParser implements SlotParser {

/**
* Create a new identity parser.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* than this will result in an exception.
* </p>
*/
public class IntegerParser implements SlotParser {
public final class IntegerParser implements SlotParser {
private static final Map<String, Integer> WORD_TO_NUM = new HashMap<>();
private static final Map<String, Integer> MULTIPLIERS = new HashMap<>();
private static final Pattern DIGIT_SPLIT_RE = Pattern.compile("[-,()\\s]");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
/**
* A parser that resolves selset values to their canonical names.
*/
public class SelsetParser implements SlotParser {
public final class SelsetParser implements SlotParser {

/**
* Create a new selset parser.
Expand Down

0 comments on commit 86b0444

Please sign in to comment.