Bugzilla – Attachment 55467 Details for
Bug 40504
Spell checker marks Hebrew and Arabic words with vowel marks as errors
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
A patch by tkos
skipDiacritics2.patch (text/plain), 2.88 KB, created by
Lior Kaplan
on 2012-01-11 13:37:30 UTC
(
hide
)
Description:
A patch by tkos
Filename:
MIME Type:
Creator:
Lior Kaplan
Created:
2012-01-11 13:37:30 UTC
Size:
2.88 KB
patch
obsolete
>Index: linguistic/source/spelldsp.cxx >=================================================================== >--- linguistic/source/spelldsp.cxx (revision 271264) >+++ linguistic/source/spelldsp.cxx (working copy) >@@ -279,6 +279,40 @@ > } > > >+// Hebrew is usually written without diacritics. >+// However, sometimes the diacritics are written as special marks located within, above, or below consonants. >+// The diacritics are represented internally as separate Unicode characters. >+// Hebrew dictionaries check for words without diacritics and will continue to do so for the forseeable future >+// This function filters the diacritics out of a word, before spellchecking it >+// (Using breakiterator is not appropriate, since we don't want word-breaking at the diacritics) >+::rtl::OUString SpellCheckerDispatcher::removeDiacritics(const ::rtl::OUString& rWord, LanguageType nLanguage) >+{ >+ OUString tmpWord; >+ OUString diacritics; >+ // Build a string containing diacritics to be skipped >+ switch (nLanguage) >+ { >+ case LANGUAGE_HEBREW : >+ int beginDiacritics; >+ int endDiacritics; >+ beginDiacritics = 0x591; // first of Hebrew cantillation marks >+ endDiacritics = 0x5C5; // last of Hebrew niqqud >+ for (int i = beginDiacritics; i <= endDiacritics; i++) >+ diacritics += OUString((sal_Unicode)i); >+ break; >+ default: >+ return rWord; >+ } >+ // Filter the diacritics from the word >+ for (int i = 0; i < rWord.getLength(); i ++) >+ { >+ sal_Unicode c = rWord.getStr()[i]; >+ if (diacritics.indexOf(c) < 0) >+ tmpWord += rWord.copy(i, 1); >+ } >+ return tmpWord; >+} >+ > BOOL SpellCheckerDispatcher::isValid_Impl( > const OUString& rWord, > LanguageType nLanguage, >@@ -304,7 +338,9 @@ > } > else > { >- OUString aChkWord( rWord ); >+ bool bRemoveDiacritics = >+ nLanguage == LANGUAGE_HEBREW ; >+ OUString aChkWord( bRemoveDiacritics ? removeDiacritics(rWord, nLanguage) : rWord ); > Locale aLocale( CreateLocale( nLanguage ) ); > > // replace typographical apostroph by ascii apostroph >@@ -480,7 +516,9 @@ > } > else > { >- OUString aChkWord( rWord ); >+ bool bRemoveDiacritics = >+ nLanguage == LANGUAGE_HEBREW ; >+ OUString aChkWord( bRemoveDiacritics ? removeDiacritics(rWord, nLanguage) : rWord ); > Locale aLocale( CreateLocale( nLanguage ) ); > > // replace typographical apostroph by ascii apostroph >Index: linguistic/source/spelldsp.hxx >=================================================================== >--- linguistic/source/spelldsp.hxx (revision 271264) >+++ linguistic/source/spelldsp.hxx (working copy) >@@ -93,6 +93,8 @@ > > void ClearSvcList(); > >+ ::rtl::OUString removeDiacritics(const ::rtl::OUString& rWord, LanguageType nLanguage); >+ > BOOL isValid_Impl(const ::rtl::OUString& aWord, LanguageType nLanguage, > const ::com::sun::star::beans::PropertyValues& aProperties, > BOOL bCheckDics)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 40504
: 55467