crfrs 0.1.0

Generic structured-perceptron sequence labeler with Viterbi decoding
Documentation
//! Error types for crfrs.

use thiserror::Error;

/// Errors produced by crfrs operations.
#[derive(Debug, Error)]
pub enum Error {
    /// The model has not been loaded yet.
    #[error("model is not loaded")]
    ModelNotLoaded,
    /// A file I/O error occurred.
    #[error("I/O error: {0}")]
    Io(#[from] std::io::Error),
    /// The model file could not be deserialized.
    #[error("model deserialization failed: {0}")]
    Json(#[from] serde_json::Error),
    /// The input sequence was empty.
    #[error("empty input sequence")]
    EmptyInput,
    /// The label set was empty.
    #[error("label set must not be empty")]
    EmptyLabels,
}

/// A specialized `Result` type for crfrs operations.
pub type Result<T> = std::result::Result<T, Error>;