Crate vi

Source
Expand description

A Vietnamese typing composition engine.

VI implement support for Vietnamese text composition using the two most common methods: Telex and VNI. The two main methods of this library is telex::transform_buffer and vni::transform_buffer but a range of useful utility methods and constants for Vietnamese text manipulation are also exposed.

§Aspirations

  • Minimal to zero configuration. The engine should have a default configurations that fit with most usecases.
  • Support all transformation behaviours & orders. Adding a tonemark during or after typing a syllable should just work.
  • Be as fast as possible.
  • Be as simple as possible.

§Example

let inputs = vec![vec!['v', 'i', 'e', 't', '5', '6'], vec!['n', 'a', 'm']];
let mut result = String::new();
for input in inputs {
    vi::transform_buffer(&vi::VNI, input.iter().cloned(), &mut result);
    result.push(' ');
}
println!("{}", result); // prints "việt nam "

§Rules

VI aims to be as lean as possible, focusing on only the useful features and main use-cases. Therefore, the engine implemented these rules by default with no way of configuring them:

  • Tone mark are placed in the new accent: hoà instead of hòa
  • w in telex will insert ư: so chuw or chw will produce chư

Although, should you need to customise any behaviour, you can create your custom typing methods. See: methods.

Re-exports§

pub use syllable::Syllable;
pub use methods::*;

Modules§

editing
Functions used for character editing.
maps
Static character mappings for transformation.
methods
The definitions of different typing methods.
parsing
Parser for parsing an input string as a Vietnamese syllable
processor
The core of the engine, where all the transformation algorithms lives.
syllable
The cache for syllable transformation.
telexDeprecated
util
Useful utilities functions that might be helpful for developing a Vietnamese IME.
validation
Validation functions for verifying if a syllable is a valid vietnamese syllable.
vniDeprecated