GithubHelp home page GithubHelp logo

seqalign's Introduction

crates.io docs.rs Travis CI

seqalign

Introduction

This crate implements commonly-used sequence alignment methods based on edit operations. There are multiple crates available to compute edit distances. However, to my knowledge there was no crate that supports all of the following seqalign features:

  • Works on slices of any type.
  • Can return both the edit distance and the edit script/alignment.
  • Can be extended with new measures.

Example

use seqalign::Align;
use seqalign::measures::LevenshteinDamerau;

let incorrect = &['t', 'p', 'y', 'o'];
let correct = &['t', 'y', 'p', 'o', 's'];

let measure = LevenshteinDamerau::new(1, 1, 1, 1);
let alignment = measure.align(incorrect, correct);

// Get the edit distance
assert_eq!(2, alignment.distance());

// Get the edit script.
use seqalign::measures::LevenshteinDamerauOp;
use seqalign::op::IndexedOperation;

assert_eq!(vec![
  	IndexedOperation::new(LevenshteinDamerauOp::Match, 0, 0),
  	IndexedOperation::new(LevenshteinDamerauOp::Transpose(1), 1, 1),
  	IndexedOperation::new(LevenshteinDamerauOp::Match, 3, 3),
  	IndexedOperation::new(LevenshteinDamerauOp::Insert(1), 4, 4)
  ], alignment.edit_script());

seqalign's People

Contributors

danieldk avatar dependabot-preview[bot] avatar

Stargazers

 avatar

Watchers

 avatar

seqalign's Issues

Non-integer costs

The Alignment struct now uses a Vec of usize to store alignments. However, some literature uses floating point costs (e.g. for align strings with perceived distances between phonemes). Add support for measures that use non-integer costs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.