Giter Club home page Giter Club logo

hunspell's Introduction

Hunspell

Ruby interface to hunspell spell checker Copyright 2007, Gabor SEBESTYEN

WHAT IS THIS?

Hunspell is an simple native Ruby interface to the famous Hunspell spell checker library which is part of OpenOffice and Mozilla products. With this bundle you can start to develop your own AJAX based spell checker service for Ruby on Rails.

REQUIREMENTS

Before installing Hunspell ensure you have the following components already installed:

  • Ruby >= 1.8
  • rubygems
  • hunspell native library >= 1.2.x (libhunspell-1.2)
  • dictionary files: download from LibreOffice or OpenOffice websites.

INSTALLATION

The best way to get Hunspell is to use gem package manager

gem install hunspell

If you want to build Hunspell from scratch grab the source from here and execute the following command

ruby extconf.rb && make

FreeBSD gotcha: hunspell spell checker package does not deploy its header files. Run gem or ruby command with an extra option:

gem install hunspell -- --with-include-dir=<incdir>

or

ruby extconf.rb --with-include-dir=<incdir> && make

Replace incdir with the path pointing to hunspell includes.

FIRST STEPS

Here's a basic example how to use Hunspell. Cut it and run in ruby.

example.rb

require "rubygems" # import gem package manager
gem "hunspell"     # load Hunspell module
require "Hunspell" # inject Hunspell class to Ruby namespace

# instantiate Hunspell with Hungarian affix and dictionary files
#

sp = Hunspell.new("hu.aff", "hu.dic") 

# spell check Hungarian word 'ablak' (window) => true
#
puts "Is 'ablak' correct? #{sp.spellcheck('ablak')}"

# get suggestions for mispelled word 'paprika'
#   => ["kaprica", "patrica", "paprika", "papcica",
#       "papráca", "papruca", "paprima", "paprikáz",
#       "paprikása", "paprikás", "Papradnó"
#      ]
#
puts "Suggestions for 'paprica': " + sp.suggest("paprica").inspect

Note you might run this example with -Ke ruby option if you want to see accented letters instead of backslash prefixed utf codes.

FEEDBACK

Any help or report are warmly appreciated. Please visit the project's homepage at https://github.com/segabor/Hunspell and open an issue.

DISCLAIMER

This software is at an early stage. Use at own your risk! No warranty.

hunspell's People

Contributors

segabor avatar

Watchers

James Cloos 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.