dotnet add package FsBERTTokenizer --version 1.0.0
NuGet\Install-Package FsBERTTokenizer -Version 1.0.0
<PackageReference Include="FsBERTTokenizer" Version="1.0.0" />
paket add FsBERTTokenizer --version 1.0.0
#r "nuget: FsBERTTokenizer, 1.0.0"
// Install FsBERTTokenizer as a Cake Addin #addin nuget:?package=FsBERTTokenizer&version=1.0.0 // Install FsBERTTokenizer as a Cake Tool #tool nuget:?package=FsBERTTokenizer&version=1.0.0
A helper library to split a string into tokens suitable for consumption by BERT-based models. BERT requires that some words be split furhter into smaller tokens called 'word pieces'.
Tokenization requires a vocabluary dictionary. The standard text BERT vocabulary file can be loaded using the following helper function:
let vocab = BERTTokenizer.Vocabulary.loadFromFile vocabFile
The simplest way to use the tokenizer is as follows:
let sampleText = """Unos has been around for ever, & I feel like this restaurant chain peak in popularity...""" let contextText = "" let vocab = BERTTokenizer.Vocabulary.loadFromFile <path> let toLowerCase = true //for 'uncased' BERT models let maxSeqLen = 512 let ftrs = BERTTokenizer.Featurizer.toFeatures vocab toLowerCase maxSeqLen sampleText contextText
BERT Tokenizer takes two strings. Internally it will join the two strings with a separator in between and return the token sequence. This format is used for question/answer type tasks. The second string can be empty for other tasks such as text classification.
The returned 'ftrs' record contains token data, e.g token id, separator type ids, mask, etc. The data from this record can be converted to tensors for model consumption
|Product||Versions Compatible and additional computed target framework versions.|
|.NET||net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed.|
|.NET Core||netcoreapp3.0 was computed. netcoreapp3.1 was computed.|
|.NET Standard||netstandard2.1 is compatible.|
|MonoAndroid||monoandroid was computed.|
|MonoMac||monomac was computed.|
|MonoTouch||monotouch was computed.|
|Tizen||tizen60 was computed.|
|Xamarin.iOS||xamarinios was computed.|
|Xamarin.Mac||xamarinmac was computed.|
|Xamarin.TVOS||xamarintvos was computed.|
|Xamarin.WatchOS||xamarinwatchos was computed.|
- FSharp.Core (>= 6.0.1)
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.