11use std:: cell:: RefCell ;
22use std:: rc:: Rc ;
33
4- use finalfusion:: chunks:: vocab:: { NGramIndices , SubwordIndices , VocabWrap , WordIndex } ;
5- use finalfusion:: prelude:: * ;
4+ use finalfusion:: vocab:: { NGramIndices , SubwordIndices , Vocab , VocabWrap , WordIndex } ;
65use pyo3:: class:: sequence:: PySequenceProtocol ;
76use pyo3:: exceptions:: { IndexError , KeyError , ValueError } ;
87use pyo3:: prelude:: * ;
@@ -45,8 +44,8 @@ impl PyVocab {
4544 let embeds = self . embeddings . borrow ( ) ;
4645 Ok ( match embeds. vocab ( ) {
4746 VocabWrap :: FastTextSubwordVocab ( inner) => inner. ngram_indices ( word) ,
48- VocabWrap :: FinalfusionSubwordVocab ( inner) => inner. ngram_indices ( word) ,
49- VocabWrap :: FinalfusionNGramVocab ( inner) => inner. ngram_indices ( word) ,
47+ VocabWrap :: BucketSubwordVocab ( inner) => inner. ngram_indices ( word) ,
48+ VocabWrap :: ExplicitSubwordVocab ( inner) => inner. ngram_indices ( word) ,
5049 VocabWrap :: SimpleVocab ( _) => {
5150 return Err ( ValueError :: py_err (
5251 "querying n-gram indices is not supported for this vocabulary" ,
@@ -59,8 +58,8 @@ impl PyVocab {
5958 let embeds = self . embeddings . borrow ( ) ;
6059 match embeds. vocab ( ) {
6160 VocabWrap :: FastTextSubwordVocab ( inner) => Ok ( inner. subword_indices ( word) ) ,
62- VocabWrap :: FinalfusionSubwordVocab ( inner) => Ok ( inner. subword_indices ( word) ) ,
63- VocabWrap :: FinalfusionNGramVocab ( inner) => Ok ( inner. subword_indices ( word) ) ,
61+ VocabWrap :: BucketSubwordVocab ( inner) => Ok ( inner. subword_indices ( word) ) ,
62+ VocabWrap :: ExplicitSubwordVocab ( inner) => Ok ( inner. subword_indices ( word) ) ,
6463 VocabWrap :: SimpleVocab ( _) => Err ( ValueError :: py_err (
6564 "querying subwords' indices is not supported for this vocabulary" ,
6665 ) ) ,
0 commit comments