GithubHelp home page GithubHelp logo

hospimedia / raspell Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmarkow/raspell

1.0 8.0 0.0 112 KB

A Ruby binding for the Aspell spelling checker

Home Page: http://blog.evanweaver.com/files/doc/fauna/raspell/

License: Other

raspell's Introduction

raspell

An interface binding for the Aspell spelling checker.

== License

Copyright 2007, 2008 Cloudburst, LLC. Licensed under the GPL 2.0. See included LICENSE file. Portions copyright 2005 Matthias Veit, Biro Eszter and used with permission.  

The public certificate for the gem is here[http://rubyforge.org/frs/download.php/25331/evan_weaver-original-public_cert.pem]. 

If you use this software, please {make a donation}[http://blog.evanweaver.com/donate/], or {recommend Evan}[http://www.workingwithrails.com/person/7739-evan-weaver] at Working with Rails.

== Requirements

Raspell requires Aspell version 0.6 (http://www.aspell.net) and at least one Aspell dictionary. 

Mac: 
  sudo port install aspell aspell-dict-en

Ubuntu: 
  sudo apt-get install aspell libaspell-dev aspell-en
  
== Installation

Mac:
  sudo gem install raspell -- --with-opt-dir=/opt/local
  
Ubuntu:
  sudo gem install raspell
  
== Usage

Aspell lets you <tt>check</tt> words and <tt>suggest</tt> corrections. For example:
   
  require 'rubygems'
  require 'raspell'
  
  speller = Aspell.new("en_US")
  speller.suggestion_mode = Aspell::NORMAL
  
  string = "my haert wil go on"
  
  string.gsub(/[\w\']+/) do |word| 
    if !speller.check(word) 
      # word is wrong
      puts "Possible correction for #{word}:"
      puts speller.suggest(word).first
    end
  end

This outputs:

  Possible correction for haert:
  heart
  Possible correction for wil:
  Will

Note that <tt>suggest</tt> returns an array of suggestions even for words that are correctly spelled.

== Options

The most useful options are <tt>suggestion_mode</tt>, and the passthrough option <tt>ignore_case</tt>. Passthrough options have to be set as so:

  speller.set_option("ignore-case", "true")

See http://aspell.net/man-html/The-Options.html for a list of the passthrough options. 

== Reporting problems

The support forum is here[http://rubyforge.org/forum/forum.php?forum_id=13988].

Patches and contributions are very welcome. Please note that contributors are required to assign copyright for their additions to Cloudburst, LLC.

== Futher resources

* http://blog.evanweaver.com/articles/2007/03/10/add-gud-spelning-to-ur-railz-app-or-wharever

raspell's People

Contributors

evan avatar dmarkow avatar

Watchers

Benjamin Descamps avatar James Cloos avatar  avatar Naghmouchi avatar  avatar Maël avatar  avatar Nathalie Meriaux avatar

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.