Skip to content

Commit 01863a8

Browse files
committed
OPENNLP-1885: Move the subword contract into opennlp-api
SubwordTokenizer and SubwordPiece move to opennlp.tools.tokenize, next to Tokenizer and WordpieceTokenizer, matching where every other seam of this round lives. The opennlp-subword module keeps only the SentencePiece implementation.
1 parent 3fb8b6b commit 01863a8

7 files changed

Lines changed: 9 additions & 9 deletions

File tree

opennlp-extensions/opennlp-subword/src/main/java/opennlp/subword/SubwordPiece.java renamed to opennlp-api/src/main/java/opennlp/tools/tokenize/SubwordPiece.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package opennlp.subword;
17+
package opennlp.tools.tokenize;
1818

1919
import opennlp.tools.util.Span;
2020

opennlp-extensions/opennlp-subword/src/main/java/opennlp/subword/SubwordTokenizer.java renamed to opennlp-api/src/main/java/opennlp/tools/tokenize/SubwordTokenizer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
package opennlp.subword;
17+
package opennlp.tools.tokenize;
1818

1919
import java.util.List;
2020

@@ -24,7 +24,7 @@
2424
*
2525
* <p>Subword tokenization is the input layer of modern sequence models: text is decomposed into
2626
* pieces from a trained vocabulary so that any input, including words never seen in training, maps
27-
* to a bounded id space. Unlike a linguistic {@code Tokenizer}, the segmentation is
27+
* to a bounded id space. Unlike a linguistic {@link Tokenizer}, the segmentation is
2828
* vocabulary-driven, and the pieces are in the model's normalized form rather than substrings of
2929
* the input. The offsets carried by each {@link SubwordPiece} are what tie the two worlds
3030
* together: they always refer to the caller's original text.</p>

opennlp-extensions/opennlp-subword/src/main/java/opennlp/subword/sentencepiece/SentencePieceTokenizer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
import java.util.List;
2727
import java.util.Map;
2828

29-
import opennlp.subword.SubwordPiece;
30-
import opennlp.subword.SubwordTokenizer;
29+
import opennlp.tools.tokenize.SubwordPiece;
30+
import opennlp.tools.tokenize.SubwordTokenizer;
3131
import opennlp.tools.util.normalizer.AlignedText;
3232
import opennlp.tools.util.normalizer.Alignment;
3333
import opennlp.tools.util.normalizer.OffsetAwareNormalizer;

opennlp-extensions/opennlp-subword/src/test/java/opennlp/subword/sentencepiece/SentencePieceAlignmentTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import org.junit.jupiter.params.ParameterizedTest;
2323
import org.junit.jupiter.params.provider.ValueSource;
2424

25-
import opennlp.subword.SubwordPiece;
25+
import opennlp.tools.tokenize.SubwordPiece;
2626
import opennlp.tools.util.Span;
2727
import opennlp.tools.util.normalizer.AlignedText;
2828

opennlp-extensions/opennlp-subword/src/test/java/opennlp/subword/sentencepiece/SentencePieceModelValidationTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
import org.junit.jupiter.api.Test;
3232

33-
import opennlp.subword.SubwordPiece;
33+
import opennlp.tools.tokenize.SubwordPiece;
3434

3535
import static org.junit.jupiter.api.Assertions.assertEquals;
3636
import static org.junit.jupiter.api.Assertions.assertThrows;

opennlp-extensions/opennlp-subword/src/test/java/opennlp/subword/sentencepiece/SentencePieceParityTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import org.junit.jupiter.params.ParameterizedTest;
3131
import org.junit.jupiter.params.provider.ValueSource;
3232

33-
import opennlp.subword.SubwordPiece;
33+
import opennlp.tools.tokenize.SubwordPiece;
3434

3535
import static org.junit.jupiter.api.Assertions.assertEquals;
3636
import static org.junit.jupiter.api.Assertions.assertNotNull;

opennlp-extensions/opennlp-subword/src/test/java/opennlp/subword/sentencepiece/SentencePieceRealModelEvalTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
import org.junit.jupiter.api.Test;
2828

29-
import opennlp.subword.SubwordPiece;
29+
import opennlp.tools.tokenize.SubwordPiece;
3030

3131
import static org.junit.jupiter.api.Assertions.assertEquals;
3232
import static org.junit.jupiter.api.Assertions.assertTrue;

0 commit comments

Comments
 (0)