From 9d788d60a462017ecaad5ea325401ffe25e87598 Mon Sep 17 00:00:00 2001 From: "Alexey.Golubev" Date: Thu, 8 Aug 2013 08:17:00 +0000 Subject: [PATCH] =?UTF-8?q?=D0=A3=D0=B1=D1=80=D0=B0=D0=BB=20=D1=82=D0=BE?= =?UTF-8?q?=D1=87=D0=BA=D1=83=20=D0=B2=20=D0=BF=D1=83=D1=82=D0=B8,=20nodeh?= =?UTF-8?q?un=20=D0=BF=D0=BE=D0=B4=20=D0=BB=D0=B8=D0=BD=D1=83=D0=BA=D1=81?= =?UTF-8?q?=D0=BE=D0=BC=20=D0=B5=D1=91=20=D0=BD=D0=B5=20=D0=BF=D0=B5=D1=80?= =?UTF-8?q?=D0=B5=D0=B2=D0=B0=D1=80=D0=B8=D0=B2=D0=B0=D0=B5=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/nodeJSProjects@48624 954022d7-b5bf-4e40-9824-e11837661b57 --- SpellChecker/sources/spellCheck.js | 53 +++++++++++++++++++++--------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/SpellChecker/sources/spellCheck.js b/SpellChecker/sources/spellCheck.js index 4c3dd757..cc276d5f 100644 --- a/SpellChecker/sources/spellCheck.js +++ b/SpellChecker/sources/spellCheck.js @@ -2,30 +2,53 @@ var sockjs = require('sockjs'), nodehun = require('nodehun'); var arrDictionaries = {}; +function CheckDictionary( dict, correct, uncorect) +{ + if(dict) + { + dict.spellSuggest(correct, function(a,b){ + if(!a) + logger.error('Error: spelling correct word %s failed!', correct) + }); + + dict.spellSuggestions(uncorect,function(a,b){ + if(a) + logger.error('Error: spelling uncorect word %s failed!', uncorect) + }); + } + else + { + logger.error('Error: no dictionary'); + } +} + // Add en_US -arrDictionaries["1033"] = new nodehun.Dictionary(__dirname + './../Dictionaries/en_US/en_US.aff', - __dirname + './../Dictionaries/en_US/en_US.dic'); +arrDictionaries["1033"] = new nodehun.Dictionary(__dirname + '/../Dictionaries1/en_US/en_US.aff', + __dirname + '/../Dictionaries/en_US/en_US.dic'); + +//CheckDictionary( arrDictionaries["1033"], 'color', 'calor' ) + // Add ru_RU -arrDictionaries["1049"] = new nodehun.Dictionary(__dirname + './../Dictionaries/ru_RU/ru_RU.aff', - __dirname + './../Dictionaries/ru_RU/ru_RU.dic'); +arrDictionaries["1049"] = new nodehun.Dictionary(__dirname + '/../Dictionaries/ru_RU/ru_RU.aff', + __dirname + '/../Dictionaries/ru_RU/ru_RU.dic'); // Add de_DE_frami -arrDictionaries["1031"] = new nodehun.Dictionary(__dirname + './../Dictionaries/de_DE_frami/de_DE_frami.aff', - __dirname + './../Dictionaries/de_DE_frami/de_DE_frami.dic'); +arrDictionaries["1031"] = new nodehun.Dictionary(__dirname + '/../Dictionaries/de_DE_frami/de_DE_frami.aff', + __dirname + '/../Dictionaries/de_DE_frami/de_DE_frami.dic'); // Add es_ES -arrDictionaries["3082"] = new nodehun.Dictionary(__dirname + './../Dictionaries/es_ES/es_ES.aff', - __dirname + './../Dictionaries/es_ES/es_ES.dic'); +arrDictionaries["3082"] = new nodehun.Dictionary(__dirname + '/../Dictionaries/es_ES/es_ES.aff', + __dirname + '/../Dictionaries/es_ES/es_ES.dic'); // Add fr_FR -arrDictionaries["1036"] = new nodehun.Dictionary(__dirname + './../Dictionaries/fr_FR/fr_FR.aff', - __dirname + './../Dictionaries/fr_FR/fr_FR.dic'); +arrDictionaries["1036"] = new nodehun.Dictionary(__dirname + '/../Dictionaries/fr_FR/fr_FR.aff', + __dirname + '/../Dictionaries/fr_FR/fr_FR.dic'); // Add it_IT -arrDictionaries["1040"] = new nodehun.Dictionary(__dirname + './../Dictionaries/it_IT/it_IT.aff', - __dirname + './../Dictionaries/it_IT/it_IT.dic'); +arrDictionaries["1040"] = new nodehun.Dictionary(__dirname + '/../Dictionaries/it_IT/it_IT.aff', + __dirname + '/../Dictionaries/it_IT/it_IT.dic'); // Add lv_LV -arrDictionaries["1062"] = new nodehun.Dictionary(__dirname + './../Dictionaries/lv_LV/lv_LV.aff', - __dirname + './../Dictionaries/lv_LV/lv_LV.dic'); +arrDictionaries["1062"] = new nodehun.Dictionary(__dirname + '/../Dictionaries/lv_LV/lv_LV.aff', + __dirname + '/../Dictionaries/lv_LV/lv_LV.dic'); var logger = require('./../../Common/sources/logger'); - + exports.install = function (server, callbackFunction) { 'use strict'; var sockjs_opts = {sockjs_url:"http://cdn.sockjs.org/sockjs-0.3.min.js"},