MCPcopy Create free account

hub / github.com/buckhx/gobert / functions

Functions88 in github.com/buckhx/gobert

↓ 7 callersFunctionexit
(msgs ...interface{})
examples/semantic-search/main.go:90
↓ 6 callersMethodValue
()
model/bert.go:35
↓ 5 callersMethodPredictValues
PredictValues will run the BERT model on the provided texts. The returned values are in the same order as the provided texts.
model/bert.go:95
↓ 5 callersMethodprintln
(msg ...interface{})
model/bert.go:117
↓ 4 callersMethodGetID
GetID will return the ID of the token in the vocab. Will be negative if it doesn't exists
tokenize/vocab/vocab.go:59
↓ 4 callersMethodTokenize
(text string)
tokenize/tokenizer.go:12
↓ 4 callersFunctiontokenizeWhitespace
tokenizeWhitespace splits text into tokeens by whitespace, per python semantics empty strings are not included
tokenize/basic.go:86
↓ 3 callersMethodInt32
Int32 int32 representation of an ID
tokenize/vocab/vocab.go:17
↓ 2 callersMethodCount
Count will return the number of tokens in the feature by counting the mask bits
tokenize/feature.go:27
↓ 2 callersMethodFeature
Feature will create a single feature from the factory ID creation is thread safe and incremental
tokenize/feature.go:47
↓ 2 callersMethodFeatures
Features will tokenize a text
model/bert.go:89
↓ 2 callersMethodLongestSubstring
LongestSubstring returns the longest token that is a substring of the token
tokenize/vocab/vocab.go:95
↓ 2 callersFunctionNewBert
NewBert will create a new default BERT model from the exported model and vocab. Generally used for producing embeddings
model/bert.go:52
↓ 2 callersFunctionNewTokenizer
NewTokenizer returns a new FullTokenizer Use Option array to modify default behavior
tokenize/tokenizer.go:23
↓ 2 callersFunctiondownload
(model, output_path, force=False, keep=False)
export/download_pretrained.py:31
↓ 2 callersFunctionexport
(model_path, export_path, transfer_func, method_name="bert/tuned/predict", tags=["bert-tuned"],
export/util.py:7
↓ 2 callersFunctionisChinese
IsChinese validates that rune c is in the CJK range according to BERT spec
tokenize/unicode.go:65
↓ 2 callersFunctionisControl
IsControl checks wher rune c is a BERT control character
tokenize/unicode.go:47
↓ 2 callersFunctionisPunctuation
IsPunctuation checks wher rune c is a BERT punctuation character
tokenize/unicode.go:60
↓ 2 callersFunctionisWhitespace
IsWhitespace checks whether rune c is a BERT whitespace character
tokenize/unicode.go:32
↓ 2 callersFunctionmeanPool
TODO extract this into a reusable package
examples/semantic-search/engine.go:104
↓ 2 callersFunctionpadChinese
padChinese will add space padding around all CJK chars This implementation matches BasicTokenizer._tokenize_chinese_chars
tokenize/basic.go:100
↓ 2 callersFunctionsequenceFeature
SequenceFeature will take a sequence string and build features for the model from it
tokenize/feature.go:67
↓ 2 callersFunctiontruncate
truncate uses heuristic of trimming seq with longest len until seqlen satisfied
tokenize/feature.go:106
↓ 1 callersMethodAdd
Add will add an item to the vocabulary, is not thread-safe
tokenize/vocab/vocab.go:54
↓ 1 callersMethodFeatures
Features will create multiple features with incremental IDs
tokenize/feature.go:57
↓ 1 callersFunctionNewBasic
NewBasic returns a basic tokenizer. Method is supplied to match constructor of other tokenizers
tokenize/basic.go:18
↓ 1 callersFunctionNewWordpiece
NewWordpiece returns a WordpieceTokenizer with the default settings. Generally should be used in a FullTokenizer
tokenize/wordpiece.go:25
↓ 1 callersMethodPredict
(InputFunc)
model/estimator/estimator.go:28
↓ 1 callersMethodSize
* // GetToken will get a token by the ID, returns the mepty string if ID does not exist func (v Dict) GetToken(id ID) token { for k, v := range v.tok
tokenize/vocab/vocab.go:90
↓ 1 callersMethodTokenize
Tokenize will segment a texxt into individual tokens. Follows algorithm from ref-imp Clean, PadChinese, Whitespace Split, Lower?, SplitPunc, Whitespac
tokenize/basic.go:24
↓ 1 callersMethodTokenize
Tokenize will segment the text into subword tokens from the supplied vocabulary NOTE: This implementation does not EXACTLY match the ref-impl and beha
tokenize/wordpiece.go:36
↓ 1 callersMethodVocab
()
tokenize/vocab/vocab.go:10
↓ 1 callersFunctionWithModelFunc
WithModelFunc applies the given model func, used when outputs do not match the default
model/option.go:36
↓ 1 callersFunctionWithSeqLen
WithSeqLen applies the seqlen, should match max_seq_len from trained model
model/option.go:20
↓ 1 callersFunction_unzip
unzips archive and flattens directory structure
export/download_pretrained.py:59
↓ 1 callersFunctionclean
(text string)
tokenize/basic.go:41
↓ 1 callersFunctioncosSim
(x, y mat.Vector)
examples/go-similarity/main.go:61
↓ 1 callersFunctioncosSim
(x, y mat.Vector)
examples/semantic-search/engine.go:117
↓ 1 callersFunctionexport_classifier
(args)
export/export_classifier.py:29
↓ 1 callersFunctionexport_embedding
(args)
export/export_embedding.py:28
↓ 1 callersMethodloadCSV
(csvPath string, d rune)
examples/semantic-search/engine.go:33
↓ 1 callersFunctionnewEngine
(modelPath string, seqlen int32)
examples/semantic-search/engine.go:21
↓ 1 callersFunctionpool
(toks [][]float32)
examples/go-similarity/main.go:48
↓ 1 callersFunctionreadCSV
readCSV will read a CSV file and parse the records into maps keyed by column headers, requires a column with the header "text"
examples/semantic-search/csv.go:16
↓ 1 callersMethodsearch
(text string)
examples/semantic-search/engine.go:85
↓ 1 callersFunctionsplitPunc
(text string)
tokenize/basic.go:66
↓ 1 callersFunctionstripAccents
(text string)
tokenize/basic.go:55
FunctionFromFile
FromFile will read a newline delimited file into a Dict
tokenize/vocab/vocab.go:28
FunctionNew
New iwll return a a covab dict from the given tokens, IDs will match index
tokenize/vocab/vocab.go:45
FunctionNewBertClassifier
NewBertClassifier returns a model configured for classification after being fine-tuned with run_classification.py
model/classifier.go:15
FunctionNewEmbeddings
NewEmbeddings returns a pre-trained model for text embeddings
model/embedding.go:14
FunctionNewPredictor
NewPredictor creates a new Predictor in lieu of a full estimator
model/estimator/predict.go:16
MethodPredict
Predictor will apply fn to the estimator model
model/estimator/predict.go:26
FunctionPrint
Print is a utility for printing the operations in a saved model
model/bert.go:124
MethodSetMaxWordChars
SetMaxWordChars will set the max chars for a word to be tokenized, generally this should be congfigured through the FullTokenizer
tokenize/wordpiece.go:60
MethodSetUnknownToken
SetUnknownToken will set the , generally this should be congfigured through the FullTokenizer
tokenize/wordpiece.go:65
FunctionTestBasic
(t *testing.T)
tokenize/tokenizer_test.go:11
FunctionTestDictLongestSubstring
(t *testing.T)
tokenize/vocab/vocab_test.go:20
FunctionTestFeatureCount
(t *testing.T)
tokenize/feature_test.go:10
FunctionTestNewDict
(t *testing.T)
tokenize/vocab/vocab_test.go:9
FunctionTestTestBasicLower
(t *testing.T)
tokenize/basic_test.go:8
FunctionTestWordpiece
(t *testing.T)
tokenize/tokenizer_test.go:32
FunctionTest_isChinese
***** New Tests *****/
tokenize/unicode_test.go:66
FunctionTest_isControl
(t *testing.T)
tokenize/unicode_test.go:28
FunctionTest_isPunctuation
(t *testing.T)
tokenize/unicode_test.go:46
FunctionTest_isWhitespace
***** Ported Tests *****/
tokenize/unicode_test.go:9
FunctionTest_padChinese
(t *testing.T)
tokenize/basic_test.go:48
FunctionTest_sequenceFeature
(t *testing.T)
tokenize/feature_test.go:30
FunctionTest_sequenceTruncate
(t *testing.T)
tokenize/feature_test.go:54
FunctionTest_tokenizeWhitespace
(t *testing.T)
tokenize/basic_test.go:25
MethodTokenize
Tokenize will tokenize the input text First basic is applited, then wordpiece on the tokens froms basic
tokenize/full.go:13
MethodVocab
Vocab returns the vocub used for this tokenizer
tokenize/full.go:22
FunctionWithFeatureFactory
WithFeatureFactory replaces the default feature factory
model/option.go:28
FunctionWithInputFunc
WithInputFunc updates the input func, used if input tensors vary from defaults
model/option.go:44
FunctionWithLower
WithLower will lowercase all input if set to true, or skip lowering if false NOTE: kink from reference implementation is that lowering also strips acc
tokenize/tokenizer.go:40
FunctionWithMaxChars
WithMaxChars sets the maximum len of a token to be tokenized, if longer will be labeled as unknown
tokenize/tokenizer.go:56
FunctionWithTokenizer
WithTokenizer applies the given tokenizer to the model
model/option.go:12
FunctionWithUnknownToken
WithUnknownToken will alter the unkown token from default [UNK]
tokenize/tokenizer.go:48
Functioninit
()
examples/semantic-search/main.go:27
Functionmain
()
examples/go-similarity/main.go:12
Functionmain
* 1. Download base model 2. Fine tune w/ run_classifier 3. export_classifier $MODEL_DIR $EXPORT_DIR 2 4. MODEL_PATH=$EXPORT_DIR go run main.go */
examples/classifier/main.go:18
Functionmain
()
examples/raw-model/main.go:12
Functionmain
()
examples/embedding/main.go:10
Functionmain
()
examples/semantic-search/main.go:52
Functiontensors
(fs ...tokenize.Feature)
model/bert.go:146
Functiontransfer
()
export/export_classifier.py:36
Functiontransfer
()
export/export_embedding.py:39