Example #1
0
/* method:saveallwords ********************************************************/
static PyObject* m_saveallwords(PyObject* self, PyObject* args) {
	aspell_speller_save_all_word_lists(Speller(self));
	if (aspell_speller_error(Speller(self)) != 0) {
		PyErr_SetString(_AspellSpellerException, aspell_speller_error_message(Speller(self)));
		return NULL;
	}
	return_None;
}
Example #2
0
/* method:clearsession ********************************************************/
static PyObject* m_clearsession(PyObject* self, PyObject* args) {
	aspell_speller_clear_session(Speller(self));
	if (aspell_speller_error(Speller(self)) != 0) {
		PyErr_SetString(_AspellSpellerException, aspell_speller_error_message(Speller(self)));
		return NULL;
	}

	return_None;
}
Example #3
0
/* method:addReplacement ******************************************************/
static PyObject* m_addReplacement(PyObject* self, PyObject* args) {
	char *mis; int ml;
	char *cor; int cl;

	if (!PyArg_ParseTuple(args, "s#s#", &mis, &ml, &cor, &cl)) {
		PyErr_SetString(PyExc_TypeError, "two strings are required (misspelled, correct word)");
		return NULL;
	}
	aspell_speller_store_replacement(Speller(self), mis, ml, cor, cl);
	if (aspell_speller_error(Speller(self)) != 0) {
		PyErr_SetString(_AspellSpellerException, aspell_speller_error_message(Speller(self)));
		return NULL;
	}
	return_None;
}
Example #4
0
/* method:addtoSession ********************************************************/
static PyObject* m_addtoSession(PyObject* self, PyObject* args) {
	char *word;
	int   length;

	if (!PyArg_ParseTuple(args, "s#", &word, &length)) {
		PyErr_SetString(PyExc_TypeError, "Invalid argument");
		return NULL;
	}

	aspell_speller_add_to_session(Speller(self), word, length);
	if (aspell_speller_error(Speller(self)) != 0) {
		PyErr_SetString(_AspellSpellerException, aspell_speller_error_message(Speller(self)));
		return NULL;
	}
	return_None;
}
Example #5
0
/* method:addtoPersonal *******************************************************/
static PyObject* m_addtoPersonal(PyObject* self, PyObject* args) {
	char *word;
	int   length;

	if (!PyArg_ParseTuple(args, "s#", &word, &length)) {
		PyErr_SetString(PyExc_TypeError, "a string is required");
		return NULL;
	}

	aspell_speller_add_to_personal(Speller(self), word, length);
	if (aspell_speller_error(Speller(self)) != 0) {
		PyErr_SetString(_AspellSpellerException, aspell_speller_error_message(Speller(self)));
		return NULL;
	}
	return_None;
}
Example #6
0
/**
 * Check for an error - raise exception if so.
 * @param speller the spellchecker-object.
 * @return void
 * @exception Exception if there was an error.
 */
static void check_for_error(AspellSpeller * speller) {
    if (aspell_speller_error(speller) != 0) {
        rb_raise(cAspellError, "%s", aspell_speller_error_message(speller));
    }
}