GithubHelp home page GithubHelp logo

Comments (3)

evanrichter avatar evanrichter commented on June 12, 2024
  • create a branch with skeleton code

ready to go for @amp813 ! See the spell-check branch

from cipher-project-1.

evanrichter avatar evanrichter commented on June 12, 2024

a helpful library for various string similarity functions: strsim

I made a single word spell checker using Levenshtein "edit" distance in this dictionary method:

/// Find the closest word by Levenshtein distance.
///
/// Returns (dictionary_word, edit_distance)
///
/// The lower the score, the fewer edits needed to match the dictionary word.
pub fn best_levenshtein(&self, word: &str) -> (&str, usize) {
// iterate over words in dictionary
self.words
.iter()
.map(|s| s.as_str())
// create tuples of &str and the respective levenshtein distance
.map(|s| (s, strsim::levenshtein(word, s)))
// return the best word-score tuple
.min_by_key(|x| x.1)
.expect("spell correct with an empty Dictionary")
}

from cipher-project-1.

evanrichter avatar evanrichter commented on June 12, 2024

@amp813 have you taken a look at the file words/plaintext_dictionary_test1.txt? It looks like we know 5 possible plaintexts in their entirety, not just the wordlist.

If test 1 must encrypt one of these five plaintexts, then you should make a special case if the near-plaintext is close to these, then pick one exactly.

I can make helper functions to parse out the sentences from this file, and make them available.

from cipher-project-1.

Related Issues (12)

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.