pub struct CodeEDA { /* private fields */ }Expand description
Easy Data Augmentation for code
Implementations§
Source§impl CodeEDA
impl CodeEDA
Sourcepub fn with_config(config: CodeEDAConfig) -> Self
pub fn with_config(config: CodeEDAConfig) -> Self
Create a new CodeEDA augmenter with custom config
Sourcepub fn augment(&mut self, code: &str, n_augmentations: usize) -> Vec<String>
pub fn augment(&mut self, code: &str, n_augmentations: usize) -> Vec<String>
Generate augmented versions of the input code
Returns a vector of augmented code strings that pass quality threshold.
Sourcepub fn quality_score(&self, augmented: &str, original: &str) -> f32
pub fn quality_score(&self, augmented: &str, original: &str) -> f32
Calculate quality score for augmented code
Returns score in [0.0, 1.0] based on:
- Syntactic validity (must parse)
- Token overlap with original
Sourcepub fn diversity_score(&self, batch: &[String]) -> f32
pub fn diversity_score(&self, batch: &[String]) -> f32
Calculate diversity score for a batch of augmented code
Returns score in [0.0, 1.0], higher means more diverse
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodeEDA
impl RefUnwindSafe for CodeEDA
impl Send for CodeEDA
impl Sync for CodeEDA
impl Unpin for CodeEDA
impl UnsafeUnpin for CodeEDA
impl UnwindSafe for CodeEDA
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more