Skip to content

Fix typos in strings and comments #1770

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bindings/node/lib/bindings/encoding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('Encoding', () => {
expect(indexes).toEqual([3, 5])
})

it('returns the corrent indexes with pair sequences', () => {
it('returns the correct indexes with pair sequences', () => {
expect(encodingDual.wordToTokens(3, 0)).toEqual([3, 5])
expect(encodingDual.wordToTokens(3, 1)).toEqual([8, 9])
})
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ tempfile = "3.10"
pyo3 = { version = "0.23", features = ["auto-initialize"] }

[features]
defaut = ["pyo3/extension-module"]
default = ["pyo3/extension-module"]
2 changes: 1 addition & 1 deletion bindings/python/scripts/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ def main():
"--models",
type=lambda s: s.split(","),
default=pretraineds,
help=f"The pretrained tokenizers you want to test agains, (default: {pretraineds})",
help=f"The pretrained tokenizers you want to test against, (default: {pretraineds})",
)
args = parser.parse_args()

Expand Down
2 changes: 1 addition & 1 deletion bindings/python/src/decoders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ impl PyMetaspaceDec {
///
/// Args:
/// suffix (:obj:`str`, `optional`, defaults to :obj:`</w>`):
/// The suffix that was used to caracterize an end-of-word. This suffix will
/// The suffix that was used to characterize an end-of-word. This suffix will
/// be replaced by whitespaces during the decoding
#[pyclass(extends=PyDecoder, module = "tokenizers.decoders", name = "BPEDecoder")]
pub struct PyBPEDecoder {}
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/bpe/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub struct BPE {
pub unk_token: Option<String>,
/// An optional prefix to use on any subword that exist only behind another one
pub continuing_subword_prefix: Option<String>,
/// An optional suffix to caracterize and end-of-word subword
/// An optional suffix to characterize and end-of-word subword
pub end_of_word_suffix: Option<String>,
/// Do multiple unk tokens get fused
pub fuse_unk: bool,
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/bpe/trainer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ pub struct BpeTrainer {
pub initial_alphabet: HashSet<char>,
/// An optional prefix to use on any subword that exist only behind another one
pub continuing_subword_prefix: Option<String>,
/// An optional suffix to caracterize and end-of-word subword
/// An optional suffix to characterize and end-of-word subword
pub end_of_word_suffix: Option<String>,
/// An optional parameter to limit the max length of any single token
pub max_token_length: Option<usize>,
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/unigram/trainer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ impl UnigramTrainer {

let logsum_alt = (sum + freq[id] * (alternatives.len() - 1) as f64).ln();

// The frequencies of altenatives are increased by freq[i].
// The frequencies of alternatives are increased by freq[i].
let mut logprob_alt = 0.0;
for n in &alternatives[id] {
logprob_alt += (freq[*n] + freq[id]).ln() - logsum_alt;
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/wordlevel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl WordLevelBuilder {
self
}

/// Contructs a `WordLevel` model that uses the `WordLevelBuilder`'s configuration.
/// Constructs a `WordLevel` model that uses the `WordLevelBuilder`'s configuration.
pub fn build(mut self) -> Result<WordLevel> {
if let Some(vocab) = self.config.files {
self.config.vocab = WordLevel::read_file(&vocab)?;
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/wordpiece/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl WordPieceBuilder {
self
}

/// Contructs a `WordPiece` model that uses the `WordPieceBuilder`'s configuration.
/// Constructs a `WordPiece` model that uses the `WordPieceBuilder`'s configuration.
pub fn build(mut self) -> Result<WordPiece> {
if let Some(vocab) = self.config.files {
self.config.vocab = WordPiece::read_file(&vocab)?;
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/models/wordpiece/trainer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ impl WordPieceTrainer {
// Transfer the vocab
model.vocab = new_wordpiece.vocab;
model.vocab_r = new_wordpiece.vocab_r;
// The continuing_subword_prefix is the only other option to be overriden by the trainer
// The continuing_subword_prefix is the only other option to be overridden by the trainer
model.continuing_subword_prefix = new_wordpiece.continuing_subword_prefix;

Ok(special_tokens)
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/normalizers/precompiled.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn replace(transformations: &mut Vec<(char, isize)>, old_part: &str, new_part: &
transformations.extend(new_part.chars().map(|c| (c, 0)));

match diff.cmp(&0) {
// If we are adding some characters, the last DIFF characters shoud be == 1
// If we are adding some characters, the last DIFF characters should be == 1
Ordering::Greater => {
transformations
.iter_mut()
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/tokenizer/added_vocabulary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub struct AddedToken {
}

impl AddedToken {
/// Build this token from the given content, specifying if it is intented to be a
/// Build this token from the given content, specifying if it is intended to be a
/// special token. Special tokens are not normalized by default.
pub fn from<S: Into<String>>(content: S, special: bool) -> Self {
Self {
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/tokenizer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ where
self
}

/// Set the trunaction parameters.
/// Set the truncation parameters.
#[must_use]
pub fn with_truncation(mut self, trunc: Option<TruncationParams>) -> Self {
self.truncation = trunc;
Expand Down
4 changes: 2 additions & 2 deletions tokenizers/src/tokenizer/normalizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ impl NormalizedString {
});

match (start, end) {
// Targeting inexistant beginning
// Targeting inexistent beginning
(Some(s), None) => Some(s..s),
// Targeting inexistant end
// Targeting inexistent end
(None, Some(e)) => Some(e..e),
// Found the range
(Some(s), Some(e)) => Some(s..e),
Expand Down
2 changes: 1 addition & 1 deletion tokenizers/src/tokenizer/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ where
}
}

/// Invert the `is_match` flags for the wrapped Pattern. This is usefull
/// Invert the `is_match` flags for the wrapped Pattern. This is useful
/// for example when we use a regex that matches words instead of a delimiter,
/// and we want to match the delimiter.
pub struct Invert<P: Pattern>(pub P);
Expand Down